Giants deep killing method

This commit is contained in:
Nick 2023-08-24 13:39:38 -04:00
parent 734f6e1f6a
commit fe8d088870

View File

@ -45,6 +45,7 @@ namespace NewHorizons.Handlers
// Since we didn't call RemoveBody on the all planets there are some we have to call here // Since we didn't call RemoveBody on the all planets there are some we have to call here
StrangerRemoved(); StrangerRemoved();
TimberHearthRemoved(); TimberHearthRemoved();
GiantsDeepRemoved();
SunRemoved(); SunRemoved();
} }
@ -114,6 +115,17 @@ namespace NewHorizons.Handlers
GameObject.Destroy(obj.gameObject); GameObject.Destroy(obj.gameObject);
} }
} }
private static void GiantsDeepRemoved()
{
foreach (var jelly in UnityEngine.Object.FindObjectsOfType<JellyfishController>())
{
if (jelly.GetSector().GetRootSector().GetName() == Sector.Name.GiantsDeep)
{
DisableGameObject(jelly.gameObject);
}
}
}
#endregion #endregion
public static void DisableAstroObject(AstroObject ao, List<AstroObject> toDisable = null) public static void DisableAstroObject(AstroObject ao, List<AstroObject> toDisable = null)
@ -157,13 +169,7 @@ namespace NewHorizons.Handlers
break; break;
case AstroObject.Name.GiantsDeep: case AstroObject.Name.GiantsDeep:
foreach (var jelly in UnityEngine.Object.FindObjectsOfType<JellyfishController>()) GiantsDeepRemoved();
{
if (jelly.GetSector().GetRootSector().GetName() == Sector.Name.GiantsDeep)
{
DisableGameObject(jelly.gameObject);
}
}
break; break;
case AstroObject.Name.TimberHearth: case AstroObject.Name.TimberHearth:
TimberHearthRemoved(); TimberHearthRemoved();
@ -189,8 +195,14 @@ namespace NewHorizons.Handlers
// Some children might be astro objects and as such can have children of their own // Some children might be astro objects and as such can have children of their own
var childAO = child.GetComponent<AstroObject>(); var childAO = child.GetComponent<AstroObject>();
if (childAO != null) DisableAstroObject(childAO, toDisable); if (childAO != null)
else DisableGameObject(child); {
DisableAstroObject(childAO, toDisable);
}
else
{
DisableGameObject(child);
}
} }
// Always delete moons // Always delete moons