public void TrySetToGameOverState(Object source, ElapsedEventArgs e)
 {
     if (_timeService.GetGameTimeElapsed() >= Duration)
     {
         _timeService.StopGameTimer();
         _timeService.DisableEventDispatching();
         ChangeState(new GameOverState());
         Notify();
     }
 }
예제 #2
0
        public void Execute()
        {
            _timerWasRunning            = _timeService.TimerIsRunning;
            _eventDispatchingWasEnabled = _timeService.EventDispatchingEnabled;
            _previousState = _raceInstance.State;

            _timeService.DisableEventDispatching();
            _timeService.StopGameTimer();
            _raceInstance.ChangeState(new PausedState());
            _raceInstance.Notify();
        }
예제 #3
0
 public void Undo()
 {
     _timeService.DisableEventDispatching();
     _timeService.RestartGameTimer();
 }