public List <Tile> GetTilesInLine(MapPosition origin, bool horizontal, int dir, int limit) { List <Tile> tiles = new List <Tile>(); for (int i = 1; i <= limit; i += dir) { MapPosition position = origin.Increment(horizontal, dir); Tile possible = IsWithinBounds(position) ? TileAtMapPosition(position) : null; if (possible != null) { tiles.Add(possible); } } return(tiles); }