Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.70 KB | None | 0 0
  1.         float GetCloudLevel(bool InstantFade)
  2.         {
  3.             Random.InitState(System.DateTime.Now.Millisecond); //Initialize Random.Range with a random seed
  4.             float GeneratedCloudLevel = 0;
  5.  
  6.             if (MostlyCloudyCoroutine != null) { StopCoroutine(MostlyCloudyCoroutine); }
  7.             if (CloudTallnessCoroutine != null) { StopCoroutine(CloudTallnessCoroutine); }
  8.            
  9.             if (CurrentWeatherType.CloudLevel == WeatherType.CloudLevelEnum.Clear)
  10.             {
  11.                 GeneratedCloudLevel = 0.25f;
  12.                 if (!InstantFade)
  13.                 {
  14.                     MostlyCloudyCoroutine = StartCoroutine(MostlyCloudyAdjustment(10 * TransitionSpeed, 1, true));
  15.                     CloudTallnessCoroutine = StartCoroutine(CloudTallnessSequence(5 * TransitionSpeed, 800));
  16.                 }
  17.             }
  18.             else if (CurrentWeatherType.CloudLevel == WeatherType.CloudLevelEnum.MostlyClear)
  19.             {
  20.                 GeneratedCloudLevel = Random.Range(0.37f, 0.43f);
  21.                 if (!InstantFade)
  22.                 {
  23.                     MostlyCloudyCoroutine = StartCoroutine(MostlyCloudyAdjustment(10 * TransitionSpeed, 1, true));
  24.                     CloudTallnessCoroutine = StartCoroutine(CloudTallnessSequence(5 * TransitionSpeed, 800));
  25.                 }
  26.             }
  27.             else if (CurrentWeatherType.CloudLevel == WeatherType.CloudLevelEnum.PartyCloudy)
  28.             {
  29.                 GeneratedCloudLevel = Random.Range(0.46f, 0.52f);
  30.                 if (!InstantFade)
  31.                 {
  32.                     MostlyCloudyCoroutine = StartCoroutine(MostlyCloudyAdjustment(10 * TransitionSpeed, 1, true));
  33.                     CloudTallnessCoroutine = StartCoroutine(CloudTallnessSequence(5 * TransitionSpeed, 1000));
  34.                 }
  35.             }
  36.             else if (CurrentWeatherType.CloudLevel == WeatherType.CloudLevelEnum.MostlyCloudy)
  37.             {
  38.                 GeneratedCloudLevel = Random.Range(0.54f, 0.58f);
  39.                 if (!InstantFade)
  40.                 {
  41.                     MostlyCloudyCoroutine = StartCoroutine(MostlyCloudyAdjustment(10 * TransitionSpeed, 1, false));
  42.                     CloudTallnessCoroutine = StartCoroutine(CloudTallnessSequence(5 * TransitionSpeed, 1000));
  43.                 }
  44.             }
  45.             else if (CurrentWeatherType.CloudLevel == WeatherType.CloudLevelEnum.Cloudy)
  46.             {
  47.                 if (!InstantFade)
  48.                 {
  49.                     CloudTallnessCoroutine = StartCoroutine(CloudTallnessSequence(5 * TransitionSpeed, 1000));
  50.                 }
  51.  
  52.                 if (CurrentWeatherType.PrecipitationWeatherType == WeatherType.Yes_No.No)
  53.                 {
  54.                     GeneratedCloudLevel = 0.64f;
  55.                     if (!InstantFade)
  56.                     {
  57.                         MostlyCloudyCoroutine = StartCoroutine(MostlyCloudyAdjustment(10 * TransitionSpeed, 1, false));
  58.                     }
  59.                 }
  60.                 else if (CurrentWeatherType.PrecipitationWeatherType == WeatherType.Yes_No.Yes)
  61.                 {
  62.                     GeneratedCloudLevel = 0.69f;
  63.                     if (!InstantFade)
  64.                     {
  65.                         MostlyCloudyCoroutine = StartCoroutine(MostlyCloudyAdjustment(5 * TransitionSpeed, 1, true));
  66.                     }
  67.                 }
  68.             }
  69.             else if (CurrentWeatherType.CloudLevel == WeatherType.CloudLevelEnum.DontChange)
  70.             {
  71.                 GeneratedCloudLevel = m_CloudDomeMaterial.GetFloat("_uCloudsCoverage");
  72.             }
  73.  
  74.             float RoundedCloudLevel = (float)Mathf.Round(GeneratedCloudLevel * 1000f) / 1000f;
  75.             return RoundedCloudLevel;
  76.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement