mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
37 lines
972 B
C#
37 lines
972 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
namespace NewHorizons.Components
|
|
{
|
|
public class TimeLoopController : MonoBehaviour
|
|
{
|
|
private float _supernovaTime;
|
|
private bool _supernovaHappened;
|
|
|
|
public void Start()
|
|
{
|
|
GlobalMessenger.AddListener("TriggerSupernova", OnTriggerSupernova);
|
|
}
|
|
|
|
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)
|
|
{
|
|
Locator.GetDeathManager().KillPlayer(DeathType.TimeLoop);
|
|
}
|
|
}
|
|
|
|
public void OnTriggerSupernova()
|
|
{
|
|
_supernovaHappened = true;
|
|
_supernovaTime = Time.time;
|
|
}
|
|
}
|
|
}
|