private void Update() { float[,] heightMap = Noise.GenerateNoiseMap(m_ChunkSize, m_ChunkSize, seed, NoiseScale, NumOctave, Lacunarity, Persistance); Color[,] colorMap = new Color[heightMap.GetLength(0), heightMap.GetLength(1)]; for (int y = 0; y < heightMap.GetLength(0); y++) { for (int x = 0; x < heightMap.GetLength(1); x++) { for (int i = 0; i < MapRegions.Length; i++) { float height = heightMap[y, x]; Region curRegion = MapRegions[i]; if (height <= curRegion.MaxHeight) { colorMap[y, x] = curRegion.Color; break; } } } } if (EnMapDisplayType == MapDisplayType.NOISE) { m_MapDisplay.DisplayTexture(TextureGenerator.GenTextureByHeightMap(heightMap)); } else if (EnMapDisplayType == MapDisplayType.COLOR) { m_MapDisplay.DisplayTexture(TextureGenerator.GenTextureByColorMap(colorMap)); } else if (EnMapDisplayType == MapDisplayType.MESH) { m_MapDisplay.DisplayMesh(MeshGenerator.GenerateMeshData(heightMap, GridLength, MeshHeightMultipler, HeightCurve, LevelOfDetail), TextureGenerator.GenTextureByColorMap(colorMap)); } }