示例#1
0
        /// <summary>
        /// SeaGrid constructor, a seagrid has a number of tiles stored in an array
        /// </summary>
        public SeaGrid(Dictionary<ShipName, Ship> ships)
        {
            _GameTiles = new Tile[Width, Height];
            //fill array with empty Tiles
            int i = 0;
            for (i = 0; i <= Width - 1; i++) {
                for (int j = 0; j <= Height - 1; j++) {
                    _GameTiles[i, j] = new Tile(i, j, null);
                }
            }

            _Ships = ships;
        }
示例#2
0
 /// <summary>
 /// Add tile adds the ship tile
 /// </summary>
 /// <param name="tile">one of the tiles the ship is on</param>
 public void AddTile(Tile tile)
 {
     _tiles.Add(tile);
 }