Exemple #1
0
        protected override void DoUpdate()
        {
            if (WeatherMakerScript.Instance == null || WeatherProfileName == null || string.IsNullOrEmpty(WeatherProfileName.Value))
            {
                return;
            }

            WeatherMakerWeatherZoneScript zone = WeatherMakerScript.Instance.gameObject.GetComponentInChildren <WeatherMakerWeatherZoneScript>();

            if (zone != null)
            {
                zone.SingleProfile = (WeatherProfileName.Value.Equals("none", StringComparison.OrdinalIgnoreCase) ? null : WeatherMakerScript.Instance.LoadResource <WeatherMakerProfileScript>(WeatherProfileName.Value));
                zone.gameObject.SetActive(true);
            }
        }
Exemple #2
0
        internal override void Start()
        {
            manager = FindObjectOfType <WeatherPluginManager>();
            if (manager == null)
            {
                Debug.LogError("Cannot find Weather Manager.");
            }

#if WEATHER_MAKER_PRESENT
            zone = FindObjectOfType <WeatherMakerWeatherZoneScript>();
            if (zone == null)
            {
                Debug.LogError("Unable to find a WeatherMakerWeatherZoneScript");
            }


            WeatherMakerScript component = GameObject.FindObjectOfType <WeatherMakerScript>();
            if (component == null)
            {
                Debug.LogError("You don't have a WeatherMakerScript in your scene. Please see the Weather Maker Weather System plugin README for instructions.");
                return;
            }
            else
            {
                weatherMaker = component.gameObject;
            }

            if (weatherMaker == null)
            {
                Debug.LogError("Unable to find or instantiate an object with the WeatherMakerScript attached");
            }

            DontDestroyOnLoad(weatherMaker);

            if (automatedGroupProfile != null)
            {
                zone.ProfileGroup  = automatedGroupProfile;
                zone.SingleProfile = null;
                manager.isAuto     = false;

                float transisitonDuration = 15f;
                float holdDuration        = 20f;

                dayNightManager = FindObjectOfType <DayNightPluginManager>();
                if (dayNightManager != null)
                {
                    transisitonDuration = dayNightManager.GameSecondsToRealSeconds(120 * 60); // 2 hour game time
                    holdDuration        = dayNightManager.GameSecondsToRealSeconds(15 * 60);  // 1/4 hour game time
                }

                automatedGroupProfile.TransitionDuration.Minimum = transisitonDuration * 0.75f;
                automatedGroupProfile.TransitionDuration.Maximum = transisitonDuration * 1.25f;
                automatedGroupProfile.HoldDuration.Minimum       = holdDuration * 0.75f;
                automatedGroupProfile.HoldDuration.Maximum       = holdDuration * 1.25f;
            }

            // Since we've changed the config of the weather maker manager we need to trigger the OnEnable method so that it re-initializes
            weatherMaker.SetActive(false);
            weatherMaker.SetActive(true);

            WeatherMakerScript.Instance.RaiseWeatherProfileChanged(null, clearProfile, 1, 20, true, null);
#endif
        }