public void Pause(bool force = false) { if (!canPause && !force) { return; } // the actual pausing is potentially happening on a different thread. // we want to wait for the source clock to stop so we can be sure all components are in a stable state. if (!IsPaused) { decoupledClock.Stop(); Schedule(() => Pause(force)); return; } // we need to do a final check after all of our children have processed up to the paused clock time. // this is to cover cases where, for instance, the player fails in the last processed frame (which would change canPause). // as the scheduler runs before children updates, let's schedule for the next frame. Schedule(() => { if (!canPause) { return; } lastPauseActionTime = Time.Current; hudOverlay.KeyCounter.IsCounting = false; hudOverlay.Progress.Show(); pauseOverlay.Retries = RestartCount; pauseOverlay.Show(); }); }
public void Pause(bool force = false) { if (canPause || force) { lastPauseActionTime = Time.Current; hudOverlay.KeyCounter.IsCounting = false; pauseOverlay.Retries = RestartCount; pauseOverlay.Show(); sourceClock.Stop(); IsPaused = true; } else { IsPaused = false; } }
public void Pause(bool force = false) { if (canPause || force) { lastPauseActionTime = Time.Current; playerInputManager.PassThrough = true; scoreOverlay.KeyCounter.IsCounting = false; pauseOverlay.Retries = RestartCount; pauseOverlay.Show(); sourceClock.Stop(); isPaused = true; } else { isPaused = false; } }