Local scale

This commit is contained in:
Noah Pilarski 2022-08-18 03:41:39 -04:00
parent f1c30e4857
commit 16915f5d7c

View File

@ -235,17 +235,14 @@ namespace NewHorizons.Components.SizeControllers
// Reset the scale back to normal bc now its just the supernova scaling itself + destruction and heat volumes // Reset the scale back to normal bc now its just the supernova scaling itself + destruction and heat volumes
transform.localScale = Vector3.one; transform.localScale = Vector3.one;
var t = Mathf.Clamp01((Time.time - (_supernovaStartTime + supernovaScaleStart)) / (supernovaScaleEnd - supernovaScaleStart));
// 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() * Mathf.Lerp(0.9f, 1, t);
if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius(); if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius();
if (_planetDestructionVolume != null) if (_planetDestructionVolume != null)
{ {
_planetDestructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f; _planetDestructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * Mathf.Lerp(0.9f, 1, t);
var t = Mathf.Clamp01((Time.time - (_supernovaStartTime + supernovaScaleStart)) / (supernovaScaleEnd - supernovaScaleStart)); _planetDestructionVolume.GetComponent<SphereCollider>().radius = Mathf.Lerp(0.8f, 1, t);
if (t > 0)
{
_planetDestructionVolume.GetComponent<SphereCollider>().radius = Mathf.Lerp(0.8f, 1, t);
}
} }
if (Time.time > _supernovaStartTime + supernovaTime) if (Time.time > _supernovaStartTime + supernovaTime)