From 16915f5d7ca42c9111dcd85e5212e443bf7f5d23 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Thu, 18 Aug 2022 03:41:39 -0400 Subject: [PATCH] Local scale --- .../SizeControllers/StarEvolutionController.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs index 37b4287c..3cc70c8d 100644 --- a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs +++ b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs @@ -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 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 - 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 (_planetDestructionVolume != null) { - _planetDestructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f; - var t = Mathf.Clamp01((Time.time - (_supernovaStartTime + supernovaScaleStart)) / (supernovaScaleEnd - supernovaScaleStart)); - if (t > 0) - { - _planetDestructionVolume.GetComponent().radius = Mathf.Lerp(0.8f, 1, t); - } + _planetDestructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * Mathf.Lerp(0.9f, 1, t); + _planetDestructionVolume.GetComponent().radius = Mathf.Lerp(0.8f, 1, t); } if (Time.time > _supernovaStartTime + supernovaTime)