private void FreezeTimeEnd() { CachedTimeForFreezeTime = 0; CachedTimeScaleBeforeFreeze = 1; EHTime.SetTimeScale(CachedTimeScaleBeforeFreeze); OnFreezeTimeComplete?.Invoke(); OnFreezeTimeComplete = null; }
/// <summary> /// Sets a timer that will freeze the game for the desired seconds that are passed in. If there is already a freeze time that is set in place /// the one that has more time remaining will take precedent /// </summary> /// <param name="TimeInSeconds"></param> public void StartFreezeTimeForSeconds(float TimeInSeconds, UnityAction OnFreezeTimeComplete = null) { if (TimeInSeconds > CachedTimeForFreezeTime) { TimeRemainingFreezeTime = TimeInSeconds; CachedTimeForFreezeTime = TimeInSeconds; CachedTimeScaleBeforeFreeze = EHTime.TimeScale; EHTime.SetTimeScale(0); } if (OnFreezeTimeComplete != null) { this.OnFreezeTimeComplete += OnFreezeTimeComplete; } }