Esempio n. 1
0
		public void GenerateFullMap(MapParameters _parameters)
		{
			if (startedGeneration)
			{
				Debug.LogError("Geracao ja iniciada, aguarde");
				return;
			}

			startedGeneration = true;

			if (_parameters.useMeshColor)
			{
				_parameters.textureResolutionFactor = 1;
			}

			noiseGen = new Noise();
			var fullHeightMapSize = _parameters.size * fullMapParameters.fullMapSize * _parameters.textureResolutionFactor;
			//noiseGen.OnNoiseIsReady.AddListener(GenerateFullMapGameObject);
			noiseGen.ProgressBarAddAction = ProgressBarAddAction;


#if UNITY_EDITOR
			if (Application.isEditor)
				EditorCoroutine.Start(noiseGen.IEGenerateFastNoiseMap(_parameters, fullHeightMapSize, _parameters.noisePosition));
			else
				StartCoroutine(noiseGen.IEGenerateFastNoiseMap(_parameters, fullHeightMapSize, _parameters.noisePosition));
#else
			StartCoroutine(noiseGen.IEGenerateFastNoiseMap(_parameters, fullHeightMapSize, _parameters.noisePosition));
#endif
		}
		public void StartGeneration()
		{	
			ValidateLOD();
			
			if (_mapParameters.size / (_mapParameters.levelOfDetail + 1) > 255)
			{
				Debug.LogError("O numero de vertices final supera o maximo de 65000 vertices");
				_mapGenerator.EndOfFullMapGeneration();
				return;
			}
			
			
			if (!GeneratorIsSet)
			{
				Debug.LogError("Chame SetGenerator antes de comecar a geracao");
				return;
			}

			var noiseGen = new Noise();
			noiseGen.OnNoiseIsReady.AddListener(OnNoiseMapGenerated);
			noiseGen.ProgressBarAddAction = ProgressBarAddAction;

			if (Application.isEditor)
				EditorCoroutine.Start(noiseGen.IEGenerateFastNoiseMap(_mapParameters, _fullMapSize,
					_mapParameters.noisePosition));
			else
				StartCoroutine(noiseGen.IEGenerateFastNoiseMap(_mapParameters, _fullMapSize, _mapParameters.noisePosition));
		}