コード例 #1
0
        private void UpdateProfile()
        {
            // clients will get the transition sent to them via network extension
            if (WeatherMakerScript.Instance == null || !WeatherMakerScript.Instance.NetworkConnection.IsServer || (SingleProfile == null && ProfileGroup == null))
            {
                return;
            }
            else if (SingleProfile == null)
            {
                if (secondsRemainingTransition <= 0.0f || currentProfileSingle != null)
                {
                    secondsRemainingTransition = 0.0f;
                    if (currentProfileSingle != null)
                    {
                        secondsRemainingHold = 0.0f;
                    }

                    if ((secondsRemainingHold -= Time.deltaTime) <= 0.0f)
                    {
                        // setup new transition
                        WeatherMakerProfileScript oldProfile = (currentProfileSingle == null ? currentProfile : currentProfileSingle);
                        currentProfile           = ProfileGroup.PickWeightedProfile();
                        PreviousLastLocalProfile = (oldProfile == null || WeatherMakerScript.Instance.LastLocalProfile == null ? "None" : WeatherMakerScript.Instance.LastLocalProfile.name);
                        LastLocalProfile         = (currentProfile == null ? "None" : currentProfile.name);
                        RangeOfFloats duration = TransitionDuration;
                        currentProfile = WeatherMakerProfileGroupScript.OverrideProfile(currentProfile, CloudProfile, SkyProfile, AuroraProfile,
                                                                                        PrecipitationProfile, FogProfile, WindProfile, LightningProfile, SoundProfile, duration, HoldDuration);
                        secondsRemainingTransition = currentProfile.RandomTransitionDuration();
                        secondsRemainingHold       = currentProfile.RandomHoldDuration();
                        NotifyThoseInZoneOfProfileChange(oldProfile, currentProfile, secondsRemainingTransition);
                        CleanupProfile(oldProfile);
                    }
                }
                else
                {
                    // else let the transition continue
                    secondsRemainingTransition -= Time.deltaTime;
                }
                currentProfileSingle = null;
            }
            else if (SingleProfile != currentProfileSingle)
            {
                currentProfileSingle = SingleProfile;
                WeatherMakerProfileScript oldProfile = currentProfile;
                RangeOfFloats             duration   = TransitionDuration;
                currentProfile = WeatherMakerProfileGroupScript.OverrideProfile(SingleProfile, CloudProfile, SkyProfile, AuroraProfile,
                                                                                PrecipitationProfile, FogProfile, WindProfile, LightningProfile, SoundProfile, duration, HoldDuration);
                PreviousLastLocalProfile   = (oldProfile == null || WeatherMakerScript.Instance.LastLocalProfile == null ? "None" : WeatherMakerScript.Instance.LastLocalProfile.name);
                LastLocalProfile           = (currentProfile == null ? "None" : currentProfile.name);
                secondsRemainingTransition = currentProfile.RandomTransitionDuration();
                NotifyThoseInZoneOfProfileChange(oldProfile, SingleProfile, secondsRemainingTransition);
                CleanupProfile(oldProfile);
            }
        }
コード例 #2
0
 /// <summary>
 /// Get a profile, adding in any overrides and cloning if needed
 /// </summary>
 /// <returns></returns>
 public WeatherMakerProfileScript GetProfile()
 {
     return(WeatherMakerProfileGroupScript.OverrideProfile(Profile, CloudProfile, SkyProfile, AuroraProfile, PrecipitationProfile, FogProfile, WindProfile, LightningProfile, SoundProfile, TransitionDuration, HoldDuration));
 }