public void CreateChunk(int x, int y, int z) { var worldPos = new WorldPos(x, y, z); var chunkObject = new GameObject(string.Format("Chunk[{0}, {1}, {2}]", x, y, z)); chunkObject.transform.position = new Vector3(x, y, z); chunkObject.AddComponent <Chunk>(); var chunk = chunkObject.GetComponent <Chunk>(); chunk.WorldPos = worldPos; chunk.World = this; var terrainGenerator = new TerrainGenerator(); chunk = terrainGenerator.GenerateChunk(chunk); _chunks.Add(worldPos, chunk); }
// Start is called before the first frame update void Start() { config = GetComponent <Assets.GeneratorParameter>(); generator = new Assets.TerrainGenerator(); generator.Config = config; }