Пример #1
0
    public void InitializeBoard()
    {
        walls.GetComponent <TilemapCollider2D>().gameObject.SetActive(false);
        BOARD_WIDTH  = BASE_WIDTH + (WIDTH_GROWTH * level);
        BOARD_HEIGHT = BASE_HEIGHT + (HEIGHT_GROWTH * level);
        Rooms.ClearData();
        Leaf main = new Leaf(SIDES_BUFFER, SIDES_BUFFER, BOARD_WIDTH + SIDES_BUFFER, BOARD_HEIGHT + SIDES_BUFFER);

        for (int i = 0; i < board.GetLength(0); i++)
        {
            for (int j = 0; j < board.GetLength(1); j++)
            {
                if (board[i, j] == BoardState.Wall)
                {
                    walls.SetTile(new Vector3Int(i, j, 0), wall);
                    walls.SetColliderType(new Vector3Int(i, j, 0), Tile.ColliderType.Sprite);
                }
                else
                {
                    floors.SetTile(new Vector3Int(i, j, 0), floor);
                }
            }
        }
        walls.GetComponent <TilemapCollider2D>().gameObject.SetActive(true);
    }