public List <Tile> GetAllSameConnectedTile(Tile tile, GameHelper.TileType type) { int pid = Pathfinder.UsePid(); List <Tile> tiles = new List <Tile>(); GetAllSameConnectedTile(tiles, pid, tile, type); return(tiles); }
private void GetAllSameConnectedTile(List <Tile> tiles, int pid, Tile tile, GameHelper.TileType type) { Tile z; for (int i = 0; i < tile.neighboors.Count; i++) { z = tile.neighboors[i]; if (z != null && z.tileContent != null && z.tileContent.type == type && z.pid < pid) { tiles.Add(z); z.pid = pid; GetAllSameConnectedTile(tiles, pid, z, type); } } }