Scale planet destruction volume too

This commit is contained in:
Noah Pilarski 2022-08-10 16:57:16 -04:00
parent f28c1f3c35
commit 83d635e400
2 changed files with 12 additions and 2 deletions

View File

@ -144,6 +144,8 @@ namespace NewHorizons.Builder.Body
controller.WillExplode = starModule.goSupernova; controller.WillExplode = starModule.goSupernova;
controller.lifespan = starModule.lifespan; controller.lifespan = starModule.lifespan;
controller.normalRamp = !string.IsNullOrEmpty(starModule.starRampTexture) ? ImageUtilities.GetTexture(mod, starModule.starRampTexture) : ramp; controller.normalRamp = !string.IsNullOrEmpty(starModule.starRampTexture) ? ImageUtilities.GetTexture(mod, starModule.starRampTexture) : ramp;
controller._destructionVolume = deathVolume.GetComponent<DestructionVolume>();
controller._planetDestructionVolume = planetDestructionVolume.GetComponent<DestructionVolume>();
if (!string.IsNullOrEmpty(starModule.starCollapseRampTexture)) if (!string.IsNullOrEmpty(starModule.starCollapseRampTexture))
{ {
controller.collapseRamp = ImageUtilities.GetTexture(mod, starModule.starCollapseRampTexture); controller.collapseRamp = ImageUtilities.GetTexture(mod, starModule.starCollapseRampTexture);

View File

@ -28,7 +28,8 @@ namespace NewHorizons.Components.SizeControllers
private PlanetaryFogController _fog; private PlanetaryFogController _fog;
private MeshRenderer[] _atmosphereRenderers; private MeshRenderer[] _atmosphereRenderers;
private HeatHazardVolume _heatVolume; private HeatHazardVolume _heatVolume;
private DestructionVolume _destructionVolume; public DestructionVolume _destructionVolume;
public DestructionVolume _planetDestructionVolume;
private SolarFlareEmitter _flareEmitter; private SolarFlareEmitter _flareEmitter;
private MapMarker _mapMarker; private MapMarker _mapMarker;
private OWRigidbody _rigidbody; private OWRigidbody _rigidbody;
@ -119,7 +120,7 @@ namespace NewHorizons.Components.SizeControllers
} }
_heatVolume = GetComponentInChildren<HeatHazardVolume>(); _heatVolume = GetComponentInChildren<HeatHazardVolume>();
_destructionVolume = GetComponentInChildren<DestructionVolume>(); if (_destructionVolume != null) _destructionVolume = GetComponentInChildren<DestructionVolume>();
if (atmosphere != null) if (atmosphere != null)
{ {
@ -222,6 +223,7 @@ namespace NewHorizons.Components.SizeControllers
// Make the destruction volume scale slightly smaller so you really have to be in the supernova to die // Make the destruction volume scale slightly smaller so you really have to be in the supernova to die
if (_destructionVolume != null) _destructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f; if (_destructionVolume != null) _destructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f;
if (_planetDestructionVolume != null) _planetDestructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f;
if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius(); if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius();
if (Time.time > _supernovaStartTime + 45f) if (Time.time > _supernovaStartTime + 45f)
@ -290,6 +292,7 @@ namespace NewHorizons.Components.SizeControllers
_supernovaStartTime = Time.time; _supernovaStartTime = Time.time;
if (atmosphere != null) atmosphere.SetActive(false); if (atmosphere != null) atmosphere.SetActive(false);
if (_destructionVolume != null) _destructionVolume._deathType = DeathType.Supernova; if (_destructionVolume != null) _destructionVolume._deathType = DeathType.Supernova;
if (_planetDestructionVolume != null) _planetDestructionVolume._deathType = DeathType.Supernova;
if (_proxy != null) _proxy.StartSupernova(); if (_proxy != null) _proxy.StartSupernova();
} }
@ -308,6 +311,11 @@ namespace NewHorizons.Components.SizeControllers
_destructionVolume._deathType = DeathType.Energy; _destructionVolume._deathType = DeathType.Energy;
_destructionVolume.transform.localScale = Vector3.one; _destructionVolume.transform.localScale = Vector3.one;
} }
if (_planetDestructionVolume != null)
{
_planetDestructionVolume._deathType = DeathType.Energy;
_planetDestructionVolume.transform.localScale = Vector3.one;
}
if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one; if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one;
gameObject.SetActive(true); gameObject.SetActive(true);
transform.localScale = Vector3.one; transform.localScale = Vector3.one;