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();
        }
 public void Undo()
 {
     _timeService.DisableEventDispatching();
     _timeService.RestartGameTimer();
 }