mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
29 lines
982 B
C#
29 lines
982 B
C#
using Marshmallow.External;
|
|
using OWML.ModHelper.Events;
|
|
using UnityEngine;
|
|
using Logger = Marshmallow.Utility.Logger;
|
|
|
|
namespace Marshmallow.General
|
|
{
|
|
static class DetectorBuilder
|
|
{
|
|
public static void Make(GameObject body, AstroObject primaryBody)
|
|
{
|
|
GameObject detectorGO = new GameObject();
|
|
detectorGO.SetActive(false);
|
|
detectorGO.name = "FieldDetector";
|
|
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);
|
|
}
|
|
}
|
|
}
|