mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add base volume builder
This commit is contained in:
parent
2352d5f2d8
commit
a1e39303e4
@ -1,18 +1,14 @@
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.External.Modules;
|
||||
using OWML.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Builder.Volumes
|
||||
{
|
||||
public static class MapRestrictionVolumeBuilder
|
||||
public static class VolumeBuilder
|
||||
{
|
||||
public static MapRestrictionVolume Make(GameObject planetGO, Sector sector, VolumesModule.VolumeInfo info)
|
||||
public static TVolume Make<TVolume>(GameObject planetGO, Sector sector, VolumesModule.VolumeInfo info) where TVolume : BaseVolume
|
||||
{
|
||||
var go = new GameObject("MapRestrictionVolume");
|
||||
var go = new GameObject(typeof(TVolume).Name);
|
||||
go.SetActive(false);
|
||||
|
||||
go.transform.parent = sector?.transform ?? planetGO.transform;
|
||||
@ -25,11 +21,11 @@ namespace NewHorizons.Builder.Volumes
|
||||
var owTriggerVolume = go.AddComponent<OWTriggerVolume>();
|
||||
owTriggerVolume._shape = shape;
|
||||
|
||||
var mapRestrictionVolume = go.AddComponent<MapRestrictionVolume>();
|
||||
var volume = go.AddComponent<TVolume>();
|
||||
|
||||
go.SetActive(true);
|
||||
|
||||
return mapRestrictionVolume;
|
||||
return volume;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
using NewHorizons.Builder.Body;
|
||||
using NewHorizons.Builder.ShipLog;
|
||||
using NewHorizons.Builder.Volumes;
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.External.Configs;
|
||||
using OWML.Common;
|
||||
using System;
|
||||
@ -53,7 +54,7 @@ namespace NewHorizons.Builder.Volumes
|
||||
{
|
||||
foreach (var mapRestrictionVolume in config.Volumes.mapRestrictionVolumes)
|
||||
{
|
||||
MapRestrictionVolumeBuilder.Make(go, sector, mapRestrictionVolume);
|
||||
VolumeBuilder.Make<MapRestrictionVolume>(go, sector, mapRestrictionVolume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user