示例#1
0
        /// <summary>
        /// Method responsible for Player movement.
        /// </summary>
        /// <remarks>
        /// Asks for direction from the user, checks if Player reached the exit,
        /// heals player if he moved into a PowerUp, updates board.
        /// </remarks>
        /// <returns><c>true</c> if the player reached the exit,
        /// <c>false</c> otherwise.
        /// </returns>
        private bool MovePlayer()
        {
            // Gets the coord where player will move.
            Coord dest = currentPlayer.WhereToMove(board);

            // Checks if the player reached and exit.
            if (board.IsExit(dest))
            {
                return(true);
            }

            // Checks if player is moving into power up and heals them.
            int heal = 4;

            currentPlayer.Heal(heal * board.IsPowerUp(dest));

            // Moves player and updates board.
            board.MoveEntity(currentPlayer, dest);

            return(false);
        }