Put cloakfieldcontroller

This commit is contained in:
Nick 2022-03-20 17:56:40 -04:00
parent c5e2cc23a5
commit 675f033a11
3 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,31 @@
using NewHorizons.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Builder.Body
{
static class CloakBuilder
{
public static void Make(GameObject body, OWRigidbody rigidbody, float radius)
{
var cloak = SearchUtilities.Find("RingWorld_Body/CloakingField_IP");
var newCloak = GameObject.Instantiate(cloak, body.transform);
newCloak.transform.localPosition = Vector3.zero;
// Get all the mesh renders
var renderers = new List<Renderer>();
foreach(var renderer in body.GetComponentsInChildren<Renderer>())
{
renderers.SafeAdd(renderer);
renderer.enabled = false;
}
}
}
}

View File

@ -21,6 +21,7 @@ namespace NewHorizons.External
public bool HasReferenceFrame { get; set; } = true; public bool HasReferenceFrame { get; set; } = true;
public bool CenterOfSolarSystem { get; set; } = false; public bool CenterOfSolarSystem { get; set; } = false;
public bool IsSatellite { get; set; } public bool IsSatellite { get; set; }
public float CloakRadius { get; set; } = 0f;
// Old, see SingularityModule instead // Old, see SingularityModule instead
public float BlackHoleSize { get; set; } public float BlackHoleSize { get; set; }

View File

@ -351,6 +351,10 @@ namespace NewHorizons.Handlers
if (body.Config.Funnel != null) if (body.Config.Funnel != null)
FunnelBuilder.Make(go, go.GetComponentInChildren<ConstantForceDetector>(), rb, body.Config.Funnel); FunnelBuilder.Make(go, go.GetComponentInChildren<ConstantForceDetector>(), rb, body.Config.Funnel);
// Has to go last probably
if (body.Config.Base.CloakRadius != 0f)
CloakBuilder.Make(go, rb, body.Config.Base.CloakRadius);
return go; return go;
} }