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); }
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(); }