예제 #1
0
    public Grid(Setup_Render setup, Config_Map config, TerrainType[,] types)
    {
        gridUtils.InjectDependencies(this, setup.Mat_Terrain, setup.Mat_Border);
        _mapConfig = config;


        // GRID AND TILE INFORMATION
        Size          = config.GridSize;
        TileHeight    = config.TileSize;
        TileThickness = config.TileThickness;

        // for grid mesh
        Hexagons = new Hexagon[Size, Size];


        _terrainResource = new TerrainResource(setup);

        if (types == null)
        {
            _terrainTypes = MapGeneration.GenerateTerrainTypes(config);
        }
        else
        {
            _terrainTypes = types;
        }


        // Init Hexagons with Border
        InitHexagons();
        InitVertexData();
    }