public void BuildTerrainChunks() { m_terrainChunks = new TerrainChunkObject[WORLD_CHUNK_SIZE, WORLD_CHUNK_SIZE]; m_globalheightMap = new TerrainHeightMap(WORLD_CHUNK_SIZE * TerrainChunkObject.TERRAIN_CHUNK_TILE_SIZE); m_chunkHeigtmaps = new TerrainHeightMap[WORLD_CHUNK_SIZE, WORLD_CHUNK_SIZE]; for (int x = 0; x < WORLD_CHUNK_SIZE; x++) { for (int y = 0; y < WORLD_CHUNK_SIZE; y++) { GameObject terrainObject = new GameObject("Terrain - " + x + ", " + y); MeshBuilder.GeneratePerlinMap(x, y, m_globalheightMap, new float[] { 1.25f, 3f, 10f, 25, 0.5f }, //scale new float[] { 1f, 4.15f, 0f, 0, 0f}, //additions new float[] { 28, 5f, 2f, 0.5f, 55f }, //strength new decimal[] { 0.55m, 1m, 0.25m, 0.2m, 55m }); //limits) m_chunkHeigtmaps[x, y] = new TerrainHeightMap(TerrainChunkObject.TERRAIN_CHUNK_TILE_SIZE); m_terrainChunks[x, y] = terrainObject.AddComponent<TerrainChunkObject>(); } } for (int x = 0; x < WORLD_CHUNK_SIZE; x++) { for (int y = 0; y < WORLD_CHUNK_SIZE; y++) { m_chunkHeigtmaps[x, y].SetHeightMap(m_globalheightMap.GetPortion(x * TerrainChunkObject.TERRAIN_CHUNK_TILE_SIZE, y * TerrainChunkObject.TERRAIN_CHUNK_TILE_SIZE, TerrainChunkObject.TERRAIN_CHUNK_TILE_SIZE), m_globalheightMap.highestFloat, m_globalheightMap.lowestFloat, m_globalheightMap.totalStrength); m_terrainChunks[x, y].Build(x, y, m_chunkHeigtmaps[x, y]); } } }