Ejemplo n.º 1
0
    public void Init()
    {
        if (_tilemaps.Count > 0)
        {
            _tilemaps.Clear();
        }

        _tileCellList = new TileCell[_height, _width];
        for (int y = 0; y < _height; y++)
        {
            for (int x = 0; x < _width; x++)
            {
                _tileCellList[y, x] = new TileCell();
            }
        }
        GameObject rootScene  = GameObject.Find("MainGameScene");
        Transform  gridObject = rootScene.transform.Find("Grid");

        _grid = gridObject.GetComponent <Grid>();
        Tilemap[] maps = gridObject.GetComponentsInChildren <Tilemap>();
        for (int i = 0; i < maps.Length; i++)
        {
            eTilemapType type = (eTilemapType)i;
            _tilemaps.Add(type, maps[i]);
        }

        InitTileCell();
    }
Ejemplo n.º 2
0
 public Tilemap GetTilemap(eTilemapType type)
 {
     return(_tilemaps[type]);
 }