new-horizons/NewHorizons/General/DetectorBuilder.cs
Nick J. Connors c977cb5333 Decluttered logs and added asteroid belts
Also includes some basic proc gen
2021-12-19 02:37:52 -05:00

28 lines
863 B
C#

using OWML.Utils;
using System;
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>();
GravityVolume parentGravityVolume = primaryBody.GetAttachedOWRigidbody().GetAttachedGravityVolume();
CFD.SetValue("_detectableFields", new ForceVolume[] { parentGravityVolume });
CFD.SetValue("_inheritElement0", true);
detectorGO.SetActive(true);
}
}
}