Turn off if planet is off

This commit is contained in:
Noah Pilarski 2022-08-18 22:19:59 -04:00
parent 199d806194
commit f993a0870c
2 changed files with 10 additions and 0 deletions

View File

@ -39,6 +39,7 @@ namespace NewHorizons.Builder.Body
{
proxyController = proxy.AddComponent<NHProxy>();
proxyController.astroName = body.Config.name;
proxyController._planet = planetGO;
}
var success = SharedMake(planetGO, proxy, proxyController, body);

View File

@ -9,6 +9,7 @@ namespace NewHorizons.Components
{
public string astroName;
public GameObject _planet;
public GameObject _star;
private Renderer[] _starRenderers;
private TessellatedRenderer[] _starTessellatedRenderers;
@ -79,6 +80,14 @@ namespace NewHorizons.Components
public override void Update()
{
if (_planet == null || !_planet.activeSelf)
{
_outOfRange = false;
ToggleRendering(false);
enabled = false;
return;
}
if (_stellarRemnant != null)
{
if (_stellarRemnant.IsActiveAndEnabled())