/// <summary> /// SeaGrid constructor, a seagrid has a number of tiles stored in an array /// </summary> public SeaGrid(Dictionary<ShipName, Ship> ships) { //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; }
public Tile GetTileVerbose(int x, int y) { Tile tile = new Tile(){ Elevation = tiles[x,y].Elevation, Moisture = tiles[x,y].Moisture, Rockiness = tiles[x,y].Rockiness, Nutrients = tiles[x,y].Nutrients, Flora = tiles[x,y].Flora, Pollution = tiles[x,y].Pollution, Metal = tiles[x,y].Metal, Oil = tiles[x,y].Oil, Crystal = tiles[x,y].Crystal, Known = tiles[x,y].Known }; return tile;//returns the specific data for that tile }
public void UpdateTile(int x, int y, Tile tile) { tiles[x, y] = new Tile() { Elevation = tile.Elevation, Moisture = tile.Moisture, Rockiness = tile.Rockiness, Nutrients = tile.Nutrients, Flora = tile.Flora, Pollution = tile.Pollution, Metal = tile.Metal, Oil = tile.Oil, Crystal = tile.Crystal, Known = 2 }; }
//stick whatever params in here later //generate maps! public void Generate(int width, int height) { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { tiles[x, y] = new Tile(); tiles[x, y].Elevation = 0; tiles[x, y].Moisture = 0; tiles[x, y].Rockiness = 0; tiles[x, y].Nutrients = 0; tiles[x, y].Flora = 0; tiles[x, y].Pollution = 0; tiles[x, y].Metal = 0; tiles[x, y].Oil = 0; tiles[x, y].Crystal = 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); }