From 329b3bcbdf4d0b11c575a8e2c784b36775b1bab1 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Fri, 14 Oct 2022 03:14:42 -0500 Subject: [PATCH] smol tweak to reenable behavior Reenabling autodetection should reset the timer so you don't immediatly transition into a new state. --- Blackout/BlackoutController.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Blackout/BlackoutController.cs b/Blackout/BlackoutController.cs index e5f245c..217c6b6 100644 --- a/Blackout/BlackoutController.cs +++ b/Blackout/BlackoutController.cs @@ -151,6 +151,12 @@ public class BlackoutController : MonoBehaviour } } + void OnEnable() + { + curTime = Time.time; + lastAwakeTime = curTime; + } + void OnDisable() { ChangeBlackoutState(BlackoutState.Awake);