Ejemplo n.º 1
0
        public void AddGrid(Vector3Int gridPos)
        {
            GameObject gridObject = gridObjectPool.GetPooled();

            gridObject.SetActive(true);

            Grid grid = gridObject.GetComponent <Grid>();

            Grid.GridData data = new Grid.GridData
            {
                Seed          = seed,
                MaxHeight     = maxHeight,
                Frequency     = frequency,
                SurfaceLevel  = surfaceLevel,
                CellCount     = cellCount,
                ColorGradient = colorGradient
            };

            grid.GridPosition = gridPos;
            grid.GridScale    = gridScale;
            grid.Data         = data;

            grid.transform.position = (Vector3)grid.GridPosition * grid.GridScale;

            grid.GenerateGridValues();
            grid.ConstructMesh();

            Grids.Add(grid.GridPosition, grid);
        }
Ejemplo n.º 2
0
        public void UpdateGrid(Vector3Int gridPos)
        {
            Grid grid = Grids[gridPos];

            Grid.GridData data = new Grid.GridData
            {
                Seed          = seed,
                MaxHeight     = maxHeight,
                Frequency     = frequency,
                SurfaceLevel  = surfaceLevel,
                CellCount     = cellCount,
                ColorGradient = colorGradient
            };

            grid.GridPosition = gridPos;
            grid.GridScale    = gridScale;
            grid.Data         = data;

            grid.transform.position = (Vector3)grid.GridPosition * grid.GridScale;

            //grid.GenerateGridValues();
            grid.ConstructMesh();
        }