Пример #1
0
        /// <summary>
        /// Updates the specified game time.
        /// </summary>
        /// <param name="gameTime">The game time.</param>
        public void Update(GameTime gameTime)
        {
            // duh?
            if (_endReached)
            {
                return;
            }

            _controllerState = _nintendoController.GetState();
            _keyboardState   = Keyboard.GetState();

            ClearInputs();
            Direction?destinationDirection = GetInput();
            Cell      destinationCell      = null;

            if (destinationDirection.HasValue)
            {
                if (_currentCell.IsEnd && destinationDirection.Value == Direction.Up)
                {
                    _endReached = true;
                    return;
                }

                destinationCell = _maze.GetDestinationCell(_currentCell, destinationDirection.Value);
            }

            if (destinationCell != null)
            {
                _currentCell = destinationCell;
            }

            if (_currentCell.HasDollar)
            {
                this._dollarSound.Play();
                this._currentCell.RemoveDollar();
                this._points += _dollarValue;
            }
        }
Пример #2
0
 private void HandleInput()
 {
     _controllerState = _nintendoController.GetState();
     _keyboardState   = Keyboard.GetState();
 }