new-horizons/NewHorizons/General/DetectorBuilder.cs
Nick J. Connors d721201b0e Forked
Renamed to new horizons, updated to current versions of OWML and Outer Wilds, added BlackHoleBuilder, LavaBuilder, RingBuilder. Added support to modify existing planets with configs.
2021-12-08 00:09:11 -05:00

27 lines
911 B
C#

using OWML.Utils;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.General
{
static class DetectorBuilder
{
public static void Make(GameObject body, AstroObject primaryBody)
{
GameObject detectorGO = new GameObject("FieldDetector");
detectorGO.SetActive(false);
detectorGO.transform.parent = body.transform;
detectorGO.layer = 20;
ConstantForceDetector CFD = detectorGO.AddComponent<ConstantForceDetector>();
ForceVolume[] temp = new ForceVolume[1];
temp[0] = primaryBody.GetAttachedOWRigidbody().GetAttachedGravityVolume();
CFD.SetValue("_detectableFields", temp);
CFD.SetValue("_inheritElement0", true);
detectorGO.SetActive(true);
Logger.Log("Finished building detector", Logger.LogType.Log);
}
}
}