Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float GetCloudLevel(bool InstantFade)
- {
- Random.InitState(System.DateTime.Now.Millisecond); //Initialize Random.Range with a random seed
- float GeneratedCloudLevel = 0;
- if (MostlyCloudyCoroutine != null) { StopCoroutine(MostlyCloudyCoroutine); }
- if (CloudTallnessCoroutine != null) { StopCoroutine(CloudTallnessCoroutine); }
- if (CurrentWeatherType.CloudLevel == WeatherType.CloudLevelEnum.Clear)
- {
- GeneratedCloudLevel = 0.25f;
- if (!InstantFade)
- {
- MostlyCloudyCoroutine = StartCoroutine(MostlyCloudyAdjustment(10 * TransitionSpeed, 1, true));
- CloudTallnessCoroutine = StartCoroutine(CloudTallnessSequence(5 * TransitionSpeed, 800));
- }
- }
- else if (CurrentWeatherType.CloudLevel == WeatherType.CloudLevelEnum.MostlyClear)
- {
- GeneratedCloudLevel = Random.Range(0.37f, 0.43f);
- if (!InstantFade)
- {
- MostlyCloudyCoroutine = StartCoroutine(MostlyCloudyAdjustment(10 * TransitionSpeed, 1, true));
- CloudTallnessCoroutine = StartCoroutine(CloudTallnessSequence(5 * TransitionSpeed, 800));
- }
- }
- else if (CurrentWeatherType.CloudLevel == WeatherType.CloudLevelEnum.PartyCloudy)
- {
- GeneratedCloudLevel = Random.Range(0.46f, 0.52f);
- if (!InstantFade)
- {
- MostlyCloudyCoroutine = StartCoroutine(MostlyCloudyAdjustment(10 * TransitionSpeed, 1, true));
- CloudTallnessCoroutine = StartCoroutine(CloudTallnessSequence(5 * TransitionSpeed, 1000));
- }
- }
- else if (CurrentWeatherType.CloudLevel == WeatherType.CloudLevelEnum.MostlyCloudy)
- {
- GeneratedCloudLevel = Random.Range(0.54f, 0.58f);
- if (!InstantFade)
- {
- MostlyCloudyCoroutine = StartCoroutine(MostlyCloudyAdjustment(10 * TransitionSpeed, 1, false));
- CloudTallnessCoroutine = StartCoroutine(CloudTallnessSequence(5 * TransitionSpeed, 1000));
- }
- }
- else if (CurrentWeatherType.CloudLevel == WeatherType.CloudLevelEnum.Cloudy)
- {
- if (!InstantFade)
- {
- CloudTallnessCoroutine = StartCoroutine(CloudTallnessSequence(5 * TransitionSpeed, 1000));
- }
- if (CurrentWeatherType.PrecipitationWeatherType == WeatherType.Yes_No.No)
- {
- GeneratedCloudLevel = 0.64f;
- if (!InstantFade)
- {
- MostlyCloudyCoroutine = StartCoroutine(MostlyCloudyAdjustment(10 * TransitionSpeed, 1, false));
- }
- }
- else if (CurrentWeatherType.PrecipitationWeatherType == WeatherType.Yes_No.Yes)
- {
- GeneratedCloudLevel = 0.69f;
- if (!InstantFade)
- {
- MostlyCloudyCoroutine = StartCoroutine(MostlyCloudyAdjustment(5 * TransitionSpeed, 1, true));
- }
- }
- }
- else if (CurrentWeatherType.CloudLevel == WeatherType.CloudLevelEnum.DontChange)
- {
- GeneratedCloudLevel = m_CloudDomeMaterial.GetFloat("_uCloudsCoverage");
- }
- float RoundedCloudLevel = (float)Mathf.Round(GeneratedCloudLevel * 1000f) / 1000f;
- return RoundedCloudLevel;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement