Beispiel #1
0
    public void CreateTerrain(HeightsGenerator generator)
    {
        for (int i = 0; i < ChunksCount; i++)
        {
            for (int j = 0; j < ChunksCount; j++)
            {
                TerrainChunk chunk = CreateChunkObject(i, j);
                TerrainChunks.Add(chunk);

                chunk.gameObject.transform.parent        = gameObject.transform;
                chunk.gameObject.transform.localPosition = new Vector3(i * TerrainChunk.ChunkSize, 0, j * TerrainChunk.ChunkSize);

                chunk.gameObject.GetComponent <MeshRenderer>().material = Material;

                chunk.InitMesh();
                chunk.GenerateMeshData(i, j, generator);
            }
        }
    }