Ejemplo n.º 1
0
        void Restart(GamePadState gpState, KeyboardState kbState, double totalSeconds)
        {
            if ((this._gamePaused || this._gameOver) && (gpState.Buttons.Y == ButtonState.Pressed || kbState.IsKeyDown(Keys.R)))
            {
                System.Diagnostics.Debug.WriteLine("Restarting game...");

                this._lastGameTime    = totalSeconds;
                this._matchBeginTimer = 0;
                this._totalIdleTime   = 0;

                PlaySound("exit");

                this._gameTimer    = _maxGameTime;
                this._gameOver     = false;
                this._newHighScore = false;

                this._gameIsRunning  = false;
                this._gamePaused     = false;
                this._matchBeginning = true;

                _playerOne.Reset();
                _playerTwo.Reset();

                // Set player positions in level
                SetPlayerStartPositions();
                SetLevelCollectables();

                Window.Title = _gameTitle;
            }
        }