/// <summary> /// Gets the next spot to move. /// </summary> /// <param name="location">The location we're at.</param> /// <param name="direction">The direction to move.</param> /// <returns></returns> private MapLocation GetNextMoveSpot(MapLocation location, Direction direction) { int row = location.GetRow(); int col = location.GetColumn(); switch (direction) { case Direction.NORTH: if (col - 1 < 0) { return(null); } return(Map[row, col - 1]); case Direction.SOUTH: if (col + 1 >= GetColumnLength()) { return(null); } return(Map[row, col + 1]); case Direction.EAST: if (row + 1 >= GetRowLength()) { return(null); } return(Map[row + 1, col]); case Direction.WEST: if (row - 1 < 0) { return(null); } return(Map[row - 1, col]); } return(null); }