public Tile(World world, int x, int y) { this.World = world; this.X = x; this.Y = y; OnTileCreated?.Invoke(this); }
public BlockingTile CreateBlockerTileAt(Vector2Int pos) { //TODO check if in bounds probably; GameObject obj = Instantiate(blockingTilePrefab); BlockingTile t = obj.GetComponent <BlockingTile>(); t.Initialize(new Vector3Int(pos.x, pos.y, 0), this); t.name = t.GetType().ToString() + ": " + t.LayeredGridPosition.ToString(); t.PlaceInWorld(); t.transform.SetParent(transform); Tiles.Add(t.LayeredGridPosition, t); OnTileCreated?.Invoke(t); return(t); }
public void CreateBoard() { _safeTilesRemaining = Width * Height; for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { Tile t = new Tile(new Point(x, y)); _tiles[x, y] = t; OnTileCreated?.Invoke(t); t.OnTileRevealed += OnTileRevealed; } } PlaceBombs(); }