Scale planet destruction volume at the end

This commit is contained in:
Noah Pilarski 2022-08-15 06:25:09 -04:00
parent cc4194ccad
commit fb5b7b87c8
2 changed files with 11 additions and 4 deletions

View File

@ -39,7 +39,9 @@ namespace NewHorizons.Components.SizeControllers
private float _collapseTimer;
public float collapseTime = 10f; // seconds
public float supernovaTime = 45f; // seconds
public float supernovaScaleStart = 45f; // seconds
public float supernovaScaleEnd = 50f; // seconds
public float supernovaTime = 50f; // seconds
public float lifespan = 22f; // minutes
public float supernovaSize = 50000f;
@ -228,6 +230,12 @@ namespace NewHorizons.Components.SizeControllers
if (_planetDestructionVolume != null) _planetDestructionVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius() * 0.9f;
if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one * supernova.GetSupernovaRadius();
var t = Mathf.Clamp01((Time.time - (_supernovaStartTime + supernovaScaleStart)) / (supernovaScaleEnd - supernovaScaleStart));
if (t > 0)
{
_planetDestructionVolume.GetComponent<SphereCollider>().radius = Mathf.Lerp(0.8f, 1, t);
}
if (Time.time > _supernovaStartTime + supernovaTime)
{
DisableStar();

View File

@ -1,4 +1,4 @@
using UnityEngine;
using UnityEngine;
namespace NewHorizons.Components
{
public class TimeLoopController : MonoBehaviour
@ -14,8 +14,7 @@ namespace NewHorizons.Components
public void Update()
{
// Stock gives like 33 seconds after the sun collapses
// Gonna assume it takes like 7 seconds to collapse after the supernova trigger
if (_supernovaHappened && Time.time > _supernovaTime + 40f)
if (_supernovaHappened && Time.time > _supernovaTime + 50f)
{
Locator.GetDeathManager().KillPlayer(DeathType.TimeLoop);
}