/// <summary> /// Generates the board's tiles according to its width and height. /// </summary> public static void Initialize() { Tile tile; for (var x = 0; x < WIDTH; x++) { for (var y = 0; y < HEIGHT; y++) { tile = new Tile(new BoardPoint(x, y)); Tiles[x, y] = tile; } } }
public void AddTiles(Tile tile) { Debug.Assert(!Tiles.Contains(tile), "Duplicate Tile in TileGroup"); tile.Hotel = this.Hotel; Tiles.Add(tile); if (!Board.PointGroupDictionary.ContainsKey(tile.Point)) Board.PointGroupDictionary.Add(tile.Point, this); else if (Board.PointGroupDictionary[tile.Point] != this) { Board.PointGroupDictionary.Remove(tile.Point); Board.PointGroupDictionary.Add(tile.Point, this); } Debug.Assert(Board.PointGroupDictionary[tile.Point] == this, "Board Dictionary has wrong value for this tile."); Debug.Assert(tile.Occupied == true, "Unoccupied Tiles in Tile Group"); }
public TileGroup(Tile tile) { Board.TileGroups.Add(this); AddTiles(tile); }