Exemplo n.º 1
0
		public void OnNoiseMapGenerated(float[,] fullHeightMap)
		{
			_textureHeightMap = fullHeightMap;
			_textureMapSize = _textureHeightMap.GetLength(0);

			for (int y = 0; y < _textureMapSize; y++)
			for (int x = 0; x < _textureMapSize; x++)
			{
				var curveX = _fullMapParameters.heightCurveX.Evaluate((float) x / _textureMapSize);
				var curveY = _fullMapParameters.heightCurveY.Evaluate((float) y / _textureMapSize);

				_textureHeightMap[x, y] = Mathf.Clamp01(_textureHeightMap[x, y] * curveX * curveY);
				_textureHeightMap[x, y] = Mathf.Clamp01(_mapParameters.heightCurve.Evaluate(_textureHeightMap[x, y]));
			}

			_fullHeightMap = Noise.SimplifyNoiseMap(_textureHeightMap, _mapParameters.textureResolutionFactor);

			if (Application.isEditor)
				EditorCoroutine.Start(GenerateFullMesh());
			else
				StartCoroutine(GenerateFullMesh());
			
			ProgressBarAddAction(10);//50
		}