public void DrawMapInEditor() { var mapData = GenerateMapData(); var display = FindObjectOfType <MapDisplay>(); switch (drawMode) { case DrawMode.NoiseMap: display.DrawTexture(TextureGenerator.TextureFromHeightMap(mapData.HeightMap)); break; case DrawMode.ColourMap: display.DrawTexture( TextureGenerator.TextureFromColourMap(mapData.ColourMap, MapSize, MapSize)); break; case DrawMode.Mesh: display.DrawMesh( MeshGenerator.GenerateTerrainMesh(mapData.HeightMap, terrainData.meshHeightMultiplier, terrainData.meshHeightCurve, editorPreviewLod), TextureGenerator.TextureFromColourMap(mapData.ColourMap, MapSize, MapSize)); break; case DrawMode.FalloffMap: display.DrawTexture( TextureGenerator.TextureFromHeightMap(FalloffGenerator.GenerateFalloffMap(MapSize))); break; } }
private void OnValidate() { if (terrainData != null) { terrainData.OnValuesUpdated -= OnValuesUpdated; terrainData.OnValuesUpdated += OnValuesUpdated; } if (noiseData != null) { noiseData.OnValuesUpdated -= OnValuesUpdated; noiseData.OnValuesUpdated += OnValuesUpdated; } _falloffMap = FalloffGenerator.GenerateFalloffMap(MapSize); }
private void Awake() { _falloffMap = FalloffGenerator.GenerateFalloffMap(MapSize); }