示例#1
0
        /// <summary>
        /// Get a list of locations a unit can walk to from a position in a single turn disregarding mountains water and trees.
        /// </summary>
        /// <param name="traveler">The unit that moves</param>
        /// <param name="board">The board to move on</param>
        /// <param name="x">The starting x location</param>
        /// <param name="y">The starting y location</param>
        /// <returns>A list of tiles the traveler can move to in one turn</returns>
        public static List <ALocation> GetAdjacentSquares(UnitType traveler, Tile[,] board, int x, int y)
        {
            List <ALocation> proposedLocations = traveler.AdjecentLocationsFrom(board, x, y);

            return(proposedLocations.Where(
                       l => l.x < Game.TILES_WIDTH && l.y < Game.TILES_HEIGHT && l.x >= 0 && l.y >= 0).ToList());
        }