// Use this for initialization void Start() { manager = GameObject.FindObjectOfType <WeatherPluginManager>(); if (manager == null) { gameObject.SetActive(false); return; } precipitationTypeDropdown.ClearOptions(); List <Dropdown.OptionData> options = new List <Dropdown.OptionData>(); Array types = Enum.GetValues(typeof(WeatherProfile.PrecipitationTypeEnum)); foreach (WeatherProfile.PrecipitationTypeEnum type in types) { options.Add(new Dropdown.OptionData(type.ToString())); } precipitationTypeDropdown.AddOptions(options); }
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 }