Exemplo n.º 1
0
 public Tile(World world, int x, int y)
 {
     this.World = world;
     this.X     = x;
     this.Y     = y;
     OnTileCreated?.Invoke(this);
 }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
        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();
        }