/// <summary> /// Raises the time scale lock by one, time scale is set to 0.0f while locked /// </summary> public void Lock() { lock (this) { if (Locks++ != 0) { LocksCountChanged?.Invoke(Locks); return; } Locked?.Invoke(); LocksCountChanged?.Invoke(Locks); } }
/// <summary> /// Lowers the time scale lock by one, time scale value is applied when gets unlocked /// </summary> public void Unlock() { lock (this) { if (Locks == 0) { Log.Warning("Trying to unlock already unlocked semaphore."); return; } if (--Locks == 0) { Unlocked?.Invoke(); } LocksCountChanged?.Invoke(Locks); } }