void DoOnWeatherChange(EnviroWeatherPreset type) { if (type.Name == "Light Rain") { //Do something } }
private void UpdateClouds(EnviroWeatherPreset i, bool withTransition) { if (i == null) { return; } float speed = 500f * Time.deltaTime; if (withTransition) { speed = weatherSettings.cloudTransitionSpeed * Time.deltaTime; } cloudsConfig.cirrusAlpha = Mathf.Lerp(cloudsConfig.cirrusAlpha, i.cloudsConfig.cirrusAlpha, speed); cloudsConfig.cirrusCoverage = Mathf.Lerp(cloudsConfig.cirrusCoverage, i.cloudsConfig.cirrusCoverage, speed); cloudsConfig.cirrusColorPow = Mathf.Lerp(cloudsConfig.cirrusColorPow, i.cloudsConfig.cirrusColorPow, speed); cloudsConfig.particleLayer1Alpha = Mathf.Lerp(cloudsConfig.particleLayer1Alpha, i.cloudsConfig.particleLayer1Alpha, speed); cloudsConfig.particleLayer1Brightness = Mathf.Lerp(cloudsConfig.particleLayer1Brightness, i.cloudsConfig.particleLayer1Brightness, speed); cloudsConfig.particleLayer1ColorPow = Mathf.Lerp(cloudsConfig.particleLayer1ColorPow, i.cloudsConfig.particleLayer1ColorPow, speed); cloudsConfig.particleLayer2Alpha = Mathf.Lerp(cloudsConfig.particleLayer2Alpha, i.cloudsConfig.particleLayer2Alpha, speed); cloudsConfig.particleLayer2Brightness = Mathf.Lerp(cloudsConfig.particleLayer2Brightness, i.cloudsConfig.particleLayer2Brightness, speed); cloudsConfig.particleLayer2ColorPow = Mathf.Lerp(cloudsConfig.particleLayer2ColorPow, i.cloudsConfig.particleLayer2ColorPow, speed); // globalVolumeLightIntensity = Mathf.Lerp(globalVolumeLightIntensity, i.volumeLightIntensity, speed); shadowIntensityMod = Mathf.Lerp(shadowIntensityMod, i.shadowIntensityMod, speed); currentWeatherSkyMod = Color.Lerp(currentWeatherSkyMod, i.weatherSkyMod.Evaluate(GameTime.solarTime), speed); currentWeatherFogMod = Color.Lerp(currentWeatherFogMod, i.weatherFogMod.Evaluate(GameTime.solarTime), speed * 10); currentWeatherLightMod = Color.Lerp(currentWeatherLightMod, i.weatherLightMod.Evaluate(GameTime.solarTime), speed); }
private void DoOnWeatherChange(EnviroWeatherPreset type) { if (!(type.Name == "Light Rain")) { ; } }
public static void CreateMyAsset() { EnviroWeatherPreset wpreset = ScriptableObject.CreateInstance <EnviroWeatherPreset>(); wpreset.Name = "New Weather Preset " + UnityEngine.Random.Range(0, 999999).ToString(); wpreset.weatherFogMod = CreateGradient(); wpreset.weatherSkyMod = CreateGradient(); wpreset.weatherLightMod = CreateGradient(); wpreset.version = "1.9.0"; // Create and save the new profile with unique name string path = AssetDatabase.GetAssetPath(Selection.activeObject); if (path == "") { path = "Assets"; } string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/New " + "Weather Preset" + ".asset"); AssetDatabase.CreateAsset(wpreset, assetPathAndName); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); EditorUtility.FocusProjectWindow(); Selection.activeObject = wpreset; }
void DoOnWeatherChange(EnviroWeatherPreset type) { //Debug.Log("Weather changed to "+type.name); //TODO : Change icon based on the EnviroWeatherPreset returned switch (type.name) { case "Cloudy 1": ImageCurrentWeather.GetComponent <Image>().sprite = Cloudy; break; case "Cloudy 2": ImageCurrentWeather.GetComponent <Image>().sprite = Cloudy2; break; case "Light Rain": ImageCurrentWeather.GetComponent <Image>().sprite = LightRain; break; case "Heavy Rain": ImageCurrentWeather.GetComponent <Image>().sprite = HeavyRain; break; default: ImageCurrentWeather.GetComponent <Image>().sprite = Sunny; break; } }
void OnEnable() { myTarget = (EnviroWeatherPreset)target; serializedObj = new SerializedObject(myTarget); fogMod = serializedObj.FindProperty("weatherFogMod"); skyMod = serializedObj.FindProperty("weatherSkyMod"); lightMod = serializedObj.FindProperty("weatherLightMod"); }
private void WeatherUpdate() { this.nextUpdate = EnviroSky.instance.currentTimeInHours + (double)this.WeatherUpdateIntervall; this.nextUpdateRealtime = Time.get_time() + this.WeatherUpdateIntervall * 60f; this.BuildNewWeatherList(); this.lastActiveZoneWeatherPrefab = this.currentActiveZoneWeatherPrefab; this.lastActiveZoneWeatherPreset = this.currentActiveZoneWeatherPreset; this.currentActiveZoneWeatherPrefab = this.PossibiltyCheck(); this.currentActiveZoneWeatherPreset = this.currentActiveZoneWeatherPrefab.weatherPreset; EnviroSky.instance.NotifyZoneWeatherChanged(this.currentActiveZoneWeatherPreset, this); }
void WeatherUpdate() { nextUpdate = EnviroSkyMgr.instance.GetCurrentTimeInHours() + WeatherUpdateIntervall; nextUpdateRealtime = Time.time + (WeatherUpdateIntervall * 60f); BuildNewWeatherList(); lastActiveZoneWeatherPrefab = currentActiveZoneWeatherPrefab; lastActiveZoneWeatherPreset = currentActiveZoneWeatherPreset; currentActiveZoneWeatherPrefab = PossibiltyCheck(); currentActiveZoneWeatherPreset = currentActiveZoneWeatherPrefab.weatherPreset; EnviroSkyMgr.instance.NotifyZoneWeatherChanged(currentActiveZoneWeatherPreset, this); }
void OnEnable() { myTarget = (EnviroWeatherPreset)target; serializedObj = new SerializedObject(myTarget); fogMod = serializedObj.FindProperty("weatherFogMod"); skyMod = serializedObj.FindProperty("weatherSkyMod"); lightMod = serializedObj.FindProperty("weatherLightMod"); #if UNITY_2019_3_OR_NEWER boxColor1 = new Color(0.95f, 0.95f, 0.95f, 1f); #else boxColor1 = new Color(0.85f, 0.85f, 0.85f, 1f); #endif }
private void UpdateFog(EnviroWeatherPreset i, bool withTransition) { // Set the Fog color to light color to match Day-Night cycle and weather Color fogClr = Color.Lerp(fogSettings.simpleFogColor.Evaluate(GameTime.solarTime), customFogColor, customFogIntensity); RenderSettings.fogColor = Color.Lerp(fogClr, currentWeatherFogMod, currentWeatherFogMod.a); if (i != null) { float speed = 500f * Time.deltaTime; if (withTransition) { speed = weatherSettings.fogTransitionSpeed * Time.deltaTime; } if (fogSettings.Fogmode == FogMode.Linear) { RenderSettings.fogEndDistance = Mathf.Lerp(RenderSettings.fogEndDistance, i.fogDistance, speed); RenderSettings.fogStartDistance = Mathf.Lerp(RenderSettings.fogStartDistance, i.fogStartDistance, speed); } else { float targetDensity = i.fogDensity; if (fogSettings.useUnityFog) { targetDensity *= fogSettings.distanceFogIntensity; } if (updateFogDensity) { RenderSettings.fogDensity = Mathf.Lerp(RenderSettings.fogDensity, targetDensity, speed) * interiorZoneSettings.currentInteriorFogMod; } } Fog.scatteringStrenght = Mathf.Lerp(Fog.scatteringStrenght, i.FogScatteringIntensity, speed); Fog.sunBlocking = Mathf.Lerp(Fog.sunBlocking, i.fogSunBlocking, speed); Fog.moonIntensity = Mathf.Lerp(Fog.moonIntensity, i.moonIntensity, speed); fogSettings.heightDensity = Mathf.Lerp(fogSettings.heightDensity, i.heightFogDensity, speed); Fog.skyFogStart = Mathf.Lerp(Fog.skyFogStart, i.skyFogStart, speed); Fog.skyFogHeight = Mathf.Lerp(Fog.skyFogHeight, i.SkyFogHeight, speed); Fog.skyFogIntensity = Mathf.Lerp(Fog.skyFogIntensity, i.SkyFogIntensity, speed); } }
void SendWeatherToClient(EnviroWeatherPreset w, EnviroZone z) { for (int i = 0; i < EnviroSkyMgr.instance.Weather.zones.Count; i++) { if (EnviroSkyMgr.instance.Weather.zones[i] == z) { zoneID = i; } } for (int i = 0; i < EnviroSkyMgr.instance.Weather.weatherPresets.Count; i++) { if (EnviroSkyMgr.instance.Weather.weatherPresets[i] == w) { RpcWeatherUpdate(i, zoneID); } } }
/// <summary> /// Update the text objects in the UI with information about time and weather /// </summary> void UpdateUiText() { if (weatherTextMesh != null) { // show weather in gui; getting the preset and using that one in order to avoid nullpointer exceptions EnviroWeatherPreset preset = EnviroSkyMgr.instance.Weather.currentActiveWeatherPreset; if (preset != null) { weatherTextMesh.text = preset.name; } } // time if (timeTextMesh != null) { timeTextMesh.text = EnviroSkyMgr.instance.GetTimeString(); } }
void SendWeatherToClient(EnviroWeatherPreset w, EnviroZone z) { int zoneID = 0; for (int i = 0; i < EnviroSkyMgr.instance.GetZoneList().Count; i++) { if (EnviroSkyMgr.instance.GetZoneList()[i] == z) { zoneID = i; } } for (int i = 0; i < EnviroSkyMgr.instance.GetCurrentWeatherPresetList().Count; i++) { if (EnviroSkyMgr.instance.GetCurrentWeatherPresetList()[i] == w) { RpcWeatherUpdate(i, zoneID); } } }
void SendWeatherToClient(EnviroWeatherPreset type, EnviroZone zone) { int weatherID = 0; int zoneID = 0; for (int i = 0; i < EnviroSkyMgr.instance.Weather.weatherPresets.Count; i++) { if (EnviroSkyMgr.instance.Weather.weatherPresets [i] == type) { weatherID = i; } } for (int i = 0; i < EnviroSkyMgr.instance.Weather.zones.Count; i++) { if (EnviroSkyMgr.instance.Weather.zones [i] == zone) { zoneID = i; } } photonView.RPC("SendWeatherUpdate", RpcTarget.OthersBuffered, weatherID, zoneID); }
/// <summary> /// Changes clouds, fog and particle effects to current weather settings instantly. /// </summary> public void InstantWeatherChange(EnviroWeatherPreset preset, EnviroWeatherPrefab prefab) { UpdateClouds(preset, false); UpdateFog(preset, false); UpdateEffectSystems(prefab, false); }
public void CreateZoneWeatherTypeList() { for (int index1 = 0; index1 < this.zoneWeatherPresets.Count; ++index1) { if (Object.op_Equality((Object)this.zoneWeatherPresets[index1], (Object)null)) { Debug.Log((object)("Warning! Missing Weather Preset in Zone: " + this.zoneName)); return; } bool flag = true; for (int index2 = 0; index2 < EnviroSky.instance.Weather.weatherPresets.Count; ++index2) { if (Object.op_Equality((Object)this.zoneWeatherPresets[index1], (Object)EnviroSky.instance.Weather.weatherPresets[index2])) { flag = false; this.zoneWeather.Add(EnviroSky.instance.Weather.WeatherPrefabs[index2]); } } if (Object.op_Equality((Object)EnviroSky.instance.Weather.VFXHolder, (Object)null)) { flag = false; } if (flag) { GameObject gameObject = new GameObject(); EnviroWeatherPrefab enviroWeatherPrefab = (EnviroWeatherPrefab)gameObject.AddComponent <EnviroWeatherPrefab>(); enviroWeatherPrefab.weatherPreset = this.zoneWeatherPresets[index1]; ((Object)gameObject).set_name(enviroWeatherPrefab.weatherPreset.Name); enviroWeatherPrefab.effectEmmisionRates.Clear(); gameObject.get_transform().set_parent(EnviroSky.instance.Weather.VFXHolder.get_transform()); gameObject.get_transform().set_localPosition(Vector3.get_zero()); gameObject.get_transform().set_localRotation(Quaternion.get_identity()); this.zoneWeather.Add(enviroWeatherPrefab); EnviroSky.instance.Weather.WeatherPrefabs.Add(enviroWeatherPrefab); EnviroSky.instance.Weather.weatherPresets.Add(this.zoneWeatherPresets[index1]); } } for (int index1 = 0; index1 < this.zoneWeather.Count; ++index1) { for (int index2 = 0; index2 < this.zoneWeather[index1].effectSystems.Count; ++index2) { this.zoneWeather[index1].effectEmmisionRates.Add(EnviroSky.GetEmissionRate(this.zoneWeather[index1].effectSystems[index2])); EnviroSky.SetEmissionRate(this.zoneWeather[index1].effectSystems[index2], 0.0f); } } if (this.isDefault && Object.op_Inequality((Object)EnviroSky.instance.Weather.startWeatherPreset, (Object)null)) { EnviroSky.instance.SetWeatherOverwrite(EnviroSky.instance.Weather.startWeatherPreset); for (int index = 0; index < this.zoneWeather.Count; ++index) { if (Object.op_Equality((Object)this.zoneWeather[index].weatherPreset, (Object)EnviroSky.instance.Weather.startWeatherPreset)) { this.currentActiveZoneWeatherPrefab = this.zoneWeather[index]; this.lastActiveZoneWeatherPrefab = this.zoneWeather[index]; } } this.currentActiveZoneWeatherPreset = EnviroSky.instance.Weather.startWeatherPreset; this.lastActiveZoneWeatherPreset = EnviroSky.instance.Weather.startWeatherPreset; } else { this.currentActiveZoneWeatherPrefab = this.zoneWeather[0]; this.lastActiveZoneWeatherPrefab = this.zoneWeather[0]; this.currentActiveZoneWeatherPreset = this.zoneWeatherPresets[0]; this.lastActiveZoneWeatherPreset = this.zoneWeatherPresets[0]; } this.nextUpdate = EnviroSky.instance.currentTimeInHours + (double)this.WeatherUpdateIntervall; }
public override void OnInspectorGUI() { myTarget = (EnviroWeatherPreset)target; #if UNITY_5_6_OR_NEWER serializedObj.UpdateIfRequiredOrScript(); #else serializedObj.UpdateIfDirtyOrScript(); #endif //Set up the box style if (boxStyle == null) { boxStyle = new GUIStyle(GUI.skin.box); boxStyle.normal.textColor = GUI.skin.label.normal.textColor; boxStyle.fontStyle = FontStyle.Bold; boxStyle.alignment = TextAnchor.UpperLeft; } if (boxStyle2 == null) { boxStyle2 = new GUIStyle(GUI.skin.label); boxStyle2.normal.textColor = GUI.skin.label.normal.textColor; boxStyle2.fontStyle = FontStyle.Bold; boxStyle2.alignment = TextAnchor.UpperLeft; } //Setup the wrap style if (wrapStyle == null) { wrapStyle = new GUIStyle(GUI.skin.label); wrapStyle.fontStyle = FontStyle.Bold; wrapStyle.wordWrap = true; } if (clearStyle == null) { clearStyle = new GUIStyle(GUI.skin.label); clearStyle.normal.textColor = GUI.skin.label.normal.textColor; clearStyle.fontStyle = FontStyle.Bold; clearStyle.alignment = TextAnchor.UpperRight; } // Begin GUILayout.BeginVertical("", boxStyle); GUILayout.Space(10); myTarget.Name = EditorGUILayout.TextField("Name", myTarget.Name); GUILayout.Space(10); // General Setup GUILayout.BeginVertical("", boxStyle); showGeneral = EditorGUILayout.BeginToggleGroup("General Configs", showGeneral); if (showGeneral) { GUILayout.BeginVertical("Sky and Light Color", boxStyle); GUILayout.Space(15); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(skyMod, true, null); EditorGUILayout.PropertyField(lightMod, true, null); if (EditorGUI.EndChangeCheck()) { serializedObj.ApplyModifiedProperties(); } EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Weather Condition", boxStyle); GUILayout.Space(15); myTarget.WindStrenght = EditorGUILayout.Slider("Wind Intensity", myTarget.WindStrenght, 0f, 1f); myTarget.wetnessLevel = EditorGUILayout.Slider("Maximum Wetness", myTarget.wetnessLevel, 0f, 1f); myTarget.snowLevel = EditorGUILayout.Slider("Maximum Snow", myTarget.snowLevel, 0f, 1f); myTarget.isLightningStorm = EditorGUILayout.Toggle("Lightning Storm", myTarget.isLightningStorm); myTarget.lightningInterval = EditorGUILayout.Slider("Lightning Interval", myTarget.lightningInterval, 1f, 60f); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Particle Effects", boxStyle); GUILayout.Space(15); if (!Application.isPlaying) { if (GUILayout.Button("Add")) { myTarget.effectSystems.Add(new EnviroWeatherEffects()); } } else { EditorGUILayout.LabelField("Can't add effects in runtime!"); } for (int i = 0; i < myTarget.effectSystems.Count; i++) { GUILayout.BeginVertical("Effect " + (i + 1), boxStyle); GUILayout.Space(15); myTarget.effectSystems[i].prefab = (GameObject)EditorGUILayout.ObjectField("Effect Prefab", myTarget.effectSystems[i].prefab, typeof(GameObject), true); myTarget.effectSystems [i].localPositionOffset = EditorGUILayout.Vector3Field("Position Offset", myTarget.effectSystems [i].localPositionOffset); myTarget.effectSystems [i].localRotationOffset = EditorGUILayout.Vector3Field("Rotation Offset", myTarget.effectSystems [i].localRotationOffset); if (GUILayout.Button("Remove")) { myTarget.effectSystems.Remove(myTarget.effectSystems[i]); } GUILayout.EndVertical(); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); // Season Setup GUILayout.BeginVertical("", boxStyle); showSeason = EditorGUILayout.BeginToggleGroup("Season Configs", showSeason); if (showSeason) { myTarget.Spring = EditorGUILayout.Toggle("Spring", myTarget.Spring); if (myTarget.Spring) { myTarget.possibiltyInSpring = EditorGUILayout.Slider("Spring Possibility", myTarget.possibiltyInSpring, 0, 100); } myTarget.Summer = EditorGUILayout.Toggle("Summer", myTarget.Summer); if (myTarget.Summer) { myTarget.possibiltyInSummer = EditorGUILayout.Slider("Summer Possibility", myTarget.possibiltyInSummer, 0, 100); } myTarget.Autumn = EditorGUILayout.Toggle("Autumn", myTarget.Autumn); if (myTarget.Autumn) { myTarget.possibiltyInAutumn = EditorGUILayout.Slider("Autumn Possibility", myTarget.possibiltyInAutumn, 0, 100); } myTarget.winter = EditorGUILayout.Toggle("Winter", myTarget.winter); if (myTarget.winter) { myTarget.possibiltyInWinter = EditorGUILayout.Slider("Winter Possibility", myTarget.possibiltyInWinter, 0, 100); } //Add Content } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); // Clouds Setup GUILayout.BeginVertical("", boxStyle); showClouds = EditorGUILayout.BeginToggleGroup("Clouds Configs", showClouds); if (showClouds) { if (GUILayout.Button("Add")) { myTarget.cloudConfig.Add(new EnviroWeatherCloudsConfig()); } for (int i = 0; i < myTarget.cloudConfig.Count; i++) { GUILayout.BeginVertical("Layer " + i, boxStyle); GUILayout.Space(15); myTarget.cloudConfig[i].BaseColor = EditorGUILayout.ColorField("Base Color", myTarget.cloudConfig[i].BaseColor); myTarget.cloudConfig[i].DirectLightInfluence = EditorGUILayout.Slider("Light Influence", myTarget.cloudConfig[i].DirectLightInfluence, 0f, 100f); myTarget.cloudConfig[i].Density = EditorGUILayout.Slider("Density", myTarget.cloudConfig[i].Density, -0.25f, 0.25f); myTarget.cloudConfig[i].Coverage = EditorGUILayout.Slider("Coverage", myTarget.cloudConfig[i].Coverage, -1f, 2f); myTarget.cloudConfig[i].Alpha = EditorGUILayout.Slider("Alpha", myTarget.cloudConfig[i].Alpha, 0f, 10f); if (GUILayout.Button("Remove")) { myTarget.cloudConfig.Remove(myTarget.cloudConfig[i]); } GUILayout.EndVertical(); } } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); // Fog Setup GUILayout.BeginVertical("", boxStyle); showFog = EditorGUILayout.BeginToggleGroup("Fog Configs", showFog); if (showFog) { GUILayout.BeginVertical("Fog Intensity", boxStyle); GUILayout.Space(15); GUILayout.BeginVertical("Linear", boxStyle2); GUILayout.Space(15); myTarget.fogStartDistance = EditorGUILayout.FloatField("Start Distance", myTarget.fogStartDistance); myTarget.fogDistance = EditorGUILayout.FloatField("End Distance", myTarget.fogDistance); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("EXP", boxStyle2); GUILayout.Space(15); myTarget.fogDensity = EditorGUILayout.FloatField("Density", myTarget.fogDensity); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Height", boxStyle2); GUILayout.Space(15); myTarget.heightFogDensity = EditorGUILayout.Slider("Height Fog Density", myTarget.heightFogDensity, 0f, 10f); EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Advanced", boxStyle); GUILayout.Space(15); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(fogMod, true, null); if (EditorGUI.EndChangeCheck()) { serializedObj.ApplyModifiedProperties(); } myTarget.FogScatteringIntensity = EditorGUILayout.Slider("Scattering Intensity", myTarget.FogScatteringIntensity, 1f, 10f); myTarget.fogSunBlocking = EditorGUILayout.Slider("Sundisk Intensity", myTarget.fogSunBlocking, 0f, 1f); GUILayout.BeginVertical("Sky Fog", boxStyle2); GUILayout.Space(15); myTarget.SkyFogHeight = EditorGUILayout.Slider("Sky Fog Height", myTarget.SkyFogHeight, 0f, 2f); myTarget.SkyFogIntensity = EditorGUILayout.Slider("Sky Fog Intensity", myTarget.SkyFogIntensity, 0f, 2f); EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); //Add Content } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); // Audio Setup GUILayout.BeginVertical("", boxStyle); showAudio = EditorGUILayout.BeginToggleGroup("Audio Configs", showAudio); if (showAudio) { myTarget.weatherSFX = (AudioClip)EditorGUILayout.ObjectField("Weather Soundeffect", myTarget.weatherSFX, typeof(AudioClip), true); GUILayout.Space(10); myTarget.SpringDayAmbient = (AudioClip)EditorGUILayout.ObjectField("Spring Day Ambient", myTarget.SpringDayAmbient, typeof(AudioClip), true); myTarget.SpringNightAmbient = (AudioClip)EditorGUILayout.ObjectField("Spring Night Ambient", myTarget.SpringNightAmbient, typeof(AudioClip), true); GUILayout.Space(10); myTarget.SummerDayAmbient = (AudioClip)EditorGUILayout.ObjectField("Summer Day Ambient", myTarget.SummerDayAmbient, typeof(AudioClip), true); myTarget.SummerNightAmbient = (AudioClip)EditorGUILayout.ObjectField("Summer Night Ambient", myTarget.SummerNightAmbient, typeof(AudioClip), true); GUILayout.Space(10); myTarget.AutumnDayAmbient = (AudioClip)EditorGUILayout.ObjectField("Autumn Day Ambient", myTarget.AutumnDayAmbient, typeof(AudioClip), true); myTarget.AutumnNightAmbient = (AudioClip)EditorGUILayout.ObjectField("Autumn Night Ambient", myTarget.AutumnNightAmbient, typeof(AudioClip), true); GUILayout.Space(10); myTarget.WinterDayAmbient = (AudioClip)EditorGUILayout.ObjectField("Winter Day Ambient", myTarget.WinterDayAmbient, typeof(AudioClip), true); myTarget.WinterNightAmbient = (AudioClip)EditorGUILayout.ObjectField("Winter Night Ambient", myTarget.WinterNightAmbient, typeof(AudioClip), true); //Add Content } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); // END EditorGUILayout.EndVertical(); EditorUtility.SetDirty(target); }
public void CreateZoneWeatherTypeList() { // Add new WeatherPrefabs for (int i = 0; i < zoneWeatherPresets.Count; i++) { if (zoneWeatherPresets [i] == null) { Debug.Log("Warning! Missing Weather Preset in Zone: " + this.zoneName); return; } bool addThis = true; for (int i2 = 0; i2 < EnviroSkyMgr.instance.GetCurrentWeatherPresetList().Count; i2++) { if (zoneWeatherPresets [i] == EnviroSkyMgr.instance.GetCurrentWeatherPresetList()[i2]) { addThis = false; zoneWeather.Add(EnviroSkyMgr.instance.GetCurrentWeatherPrefabList()[i2]); } } if (addThis) { GameObject wPrefab = new GameObject(); EnviroWeatherPrefab wP = wPrefab.AddComponent <EnviroWeatherPrefab> (); wP.weatherPreset = zoneWeatherPresets [i]; wPrefab.name = wP.weatherPreset.Name; // Check and create particle systems. for (int w = 0; w < wP.weatherPreset.effectSystems.Count; w++) { if (wP.weatherPreset.effectSystems [w] == null || wP.weatherPreset.effectSystems [w].prefab == null) { Debug.Log("Warning! Missing Particle System Entry: " + wP.weatherPreset.Name); Destroy(wPrefab); return; } GameObject eS = (GameObject)Instantiate(wP.weatherPreset.effectSystems [w].prefab, wPrefab.transform); eS.transform.localPosition = wP.weatherPreset.effectSystems [w].localPositionOffset; eS.transform.localEulerAngles = wP.weatherPreset.effectSystems [w].localRotationOffset; ParticleSystem pS = eS.GetComponent <ParticleSystem> (); if (pS != null) { wP.effectSystems.Add(pS); } else { pS = eS.GetComponentInChildren <ParticleSystem> (); if (pS != null) { wP.effectSystems.Add(pS); } else { Debug.Log("No Particle System found in prefab in weather preset: " + wP.weatherPreset.Name); Destroy(wPrefab); return; } } } wP.effectEmmisionRates.Clear(); wPrefab.transform.parent = EnviroSkyMgr.instance.GetVFXHolder().transform; wPrefab.transform.localPosition = Vector3.zero; wPrefab.transform.localRotation = Quaternion.identity; zoneWeather.Add(wP); EnviroSkyMgr.instance.GetCurrentWeatherPrefabList().Add(wP); EnviroSkyMgr.instance.GetCurrentWeatherPresetList().Add(zoneWeatherPresets [i]); } } // Setup Particle Systems Emission Rates for (int i = 0; i < zoneWeather.Count; i++) { for (int i2 = 0; i2 < zoneWeather[i].effectSystems.Count; i2++) { zoneWeather[i].effectEmmisionRates.Add(EnviroSkyMgr.instance.GetEmissionRate(zoneWeather[i].effectSystems[i2])); EnviroSkyMgr.instance.SetEmissionRate(zoneWeather[i].effectSystems[i2], 0f); } } //Set initial weather if (isDefault && EnviroSkyMgr.instance.GetStartWeatherPreset() != null) { EnviroSkyMgr.instance.ChangeWeatherInstant(EnviroSkyMgr.instance.GetStartWeatherPreset()); for (int i = 0; i < zoneWeather.Count; i++) { if (zoneWeather[i].weatherPreset == EnviroSkyMgr.instance.GetStartWeatherPreset()) { currentActiveZoneWeatherPrefab = zoneWeather[i]; lastActiveZoneWeatherPrefab = zoneWeather[i]; } } currentActiveZoneWeatherPreset = EnviroSkyMgr.instance.GetStartWeatherPreset(); lastActiveZoneWeatherPreset = EnviroSkyMgr.instance.GetStartWeatherPreset(); } else { currentActiveZoneWeatherPrefab = zoneWeather [0]; lastActiveZoneWeatherPrefab = zoneWeather [0]; currentActiveZoneWeatherPreset = zoneWeatherPresets [0]; lastActiveZoneWeatherPreset = zoneWeatherPresets [0]; } nextUpdate = EnviroSkyMgr.instance.GetCurrentTimeInHours() + WeatherUpdateIntervall; }
public override void OnInspectorGUI() { myTarget = (EnviroWeatherPreset)target; #if UNITY_5_6_OR_NEWER serializedObj.UpdateIfRequiredOrScript(); #else serializedObj.UpdateIfDirtyOrScript(); #endif //Set up the box style if (boxStyle == null) { boxStyle = new GUIStyle(GUI.skin.box); boxStyle.normal.textColor = GUI.skin.label.normal.textColor; boxStyle.fontStyle = FontStyle.Bold; boxStyle.alignment = TextAnchor.UpperLeft; } if (boxStyleModified == null) { boxStyleModified = new GUIStyle(EditorStyles.helpBox); boxStyleModified.normal.textColor = GUI.skin.label.normal.textColor; boxStyleModified.fontStyle = FontStyle.Bold; boxStyleModified.fontSize = 11; boxStyleModified.alignment = TextAnchor.UpperLeft; } //Setup the wrap style if (wrapStyle == null) { wrapStyle = new GUIStyle(GUI.skin.label); wrapStyle.fontStyle = FontStyle.Normal; wrapStyle.wordWrap = true; } if (wrapStyle2 == null) { wrapStyle2 = new GUIStyle(GUI.skin.label); wrapStyle2.fontStyle = FontStyle.Italic; wrapStyle2.wordWrap = true; } if (clearStyle == null) { clearStyle = new GUIStyle(GUI.skin.label); clearStyle.normal.textColor = GUI.skin.label.normal.textColor; clearStyle.fontStyle = FontStyle.Bold; clearStyle.alignment = TextAnchor.UpperRight; } if (headerFoldout == null) { headerFoldout = new GUIStyle(EditorStyles.foldout); headerFoldout.fontStyle = FontStyle.Bold; } if (headerStyle == null) { headerStyle = new GUIStyle(GUI.skin.label); headerStyle.fontStyle = FontStyle.Bold; headerStyle.alignment = TextAnchor.UpperLeft; } // Begin GUILayout.BeginVertical("", boxStyle); EditorGUILayout.LabelField("Enviro - Weather Preset", headerStyle); EditorGUILayout.LabelField("Setup a new weather type here. Change clouds, lighting, audio and so on and add this preset to one of your enviro weather zones to make it usable in enviro weather system. Do not forget to set a unique name in 'General Configs'!", wrapStyle); GUILayout.Space(10); // General Setup GUI.backgroundColor = boxColor1; GUILayout.BeginVertical("", boxStyleModified); GUI.backgroundColor = Color.white; showGeneral = GUILayout.Toggle(showGeneral, "General Configs", headerFoldout); if (showGeneral) { EditorGUI.BeginChangeCheck(); GUILayout.BeginVertical("Unique Name", boxStyleModified); GUILayout.Space(20); myTarget.Name = EditorGUILayout.TextField("Name", myTarget.Name); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Sky and Light Color", boxStyleModified); GUILayout.Space(15); EditorGUILayout.PropertyField(skyMod, true, null); EditorGUILayout.PropertyField(lightMod, true, null); myTarget.volumeLightIntensity = EditorGUILayout.Slider("Volume Light Intensity", myTarget.volumeLightIntensity, 0, 2); myTarget.shadowIntensityMod = EditorGUILayout.Slider("Shadow Intensity Mod", myTarget.shadowIntensityMod, -1f, 1f); #if ENVIRO_HDRP if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.LightSettings.usePhysicalBasedLighting) { myTarget.sceneExposureMod = EditorGUILayout.Slider("Scene Exposure Modification", myTarget.sceneExposureMod, 0, 2); myTarget.skyExposureMod = EditorGUILayout.Slider("Sky Exposure Modification", myTarget.skyExposureMod, 0, 2); myTarget.lightIntensityMod = EditorGUILayout.Slider("Light Intensity Modification", myTarget.lightIntensityMod, 0, 2); } #endif if (EditorGUI.EndChangeCheck()) { serializedObj.ApplyModifiedProperties(); } EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Weather Condition", boxStyleModified); GUILayout.Space(15); myTarget.WindStrenght = EditorGUILayout.Slider("Wind Intensity", myTarget.WindStrenght, 0f, 1f); myTarget.wetnessLevel = EditorGUILayout.Slider("Maximum Wetness", myTarget.wetnessLevel, 0f, 1f); myTarget.snowLevel = EditorGUILayout.Slider("Maximum Snow", myTarget.snowLevel, 0f, 1f); myTarget.temperatureLevel = EditorGUILayout.Slider("Temperature Modification", myTarget.temperatureLevel, -50f, 50f); myTarget.isLightningStorm = EditorGUILayout.Toggle("Lightning Storm", myTarget.isLightningStorm); myTarget.lightningInterval = EditorGUILayout.Slider("Lightning Interval", myTarget.lightningInterval, 2f, 60f); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Particle Effects", boxStyleModified); GUILayout.Space(15); if (!Application.isPlaying) { if (GUILayout.Button("Add")) { myTarget.effectSystems.Add(new EnviroWeatherEffects()); } } else { EditorGUILayout.LabelField("Can't add effects in runtime!"); } for (int i = 0; i < myTarget.effectSystems.Count; i++) { GUILayout.BeginVertical("Effect " + (i + 1), boxStyleModified); GUILayout.Space(15); myTarget.effectSystems[i].prefab = (GameObject)EditorGUILayout.ObjectField("Effect Prefab", myTarget.effectSystems[i].prefab, typeof(GameObject), true); myTarget.effectSystems [i].localPositionOffset = EditorGUILayout.Vector3Field("Position Offset", myTarget.effectSystems [i].localPositionOffset); myTarget.effectSystems [i].localRotationOffset = EditorGUILayout.Vector3Field("Rotation Offset", myTarget.effectSystems [i].localRotationOffset); if (GUILayout.Button("Remove")) { myTarget.effectSystems.Remove(myTarget.effectSystems[i]); } GUILayout.EndVertical(); } EditorGUILayout.EndVertical(); #if ENVIRO_HD if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.HD) { GUILayout.BeginVertical("Aurora Settings", boxStyleModified); GUILayout.Space(15); myTarget.auroraIntensity = EditorGUILayout.Slider("Aurora Intensity", myTarget.auroraIntensity, 0f, 1f); EditorGUILayout.EndVertical(); } #endif } EditorGUILayout.EndVertical(); // Season Setup GUI.backgroundColor = boxColor1; GUILayout.BeginVertical("", boxStyleModified); GUI.backgroundColor = Color.white; showSeason = GUILayout.Toggle(showSeason, "Season Configs", headerFoldout); if (showSeason) { GUILayout.BeginVertical("", boxStyleModified); myTarget.Spring = EditorGUILayout.Toggle("Spring", myTarget.Spring); if (myTarget.Spring) { myTarget.possibiltyInSpring = EditorGUILayout.Slider("Spring Possibility", myTarget.possibiltyInSpring, 0, 100); } myTarget.Summer = EditorGUILayout.Toggle("Summer", myTarget.Summer); if (myTarget.Summer) { myTarget.possibiltyInSummer = EditorGUILayout.Slider("Summer Possibility", myTarget.possibiltyInSummer, 0, 100); } myTarget.Autumn = EditorGUILayout.Toggle("Autumn", myTarget.Autumn); if (myTarget.Autumn) { myTarget.possibiltyInAutumn = EditorGUILayout.Slider("Autumn Possibility", myTarget.possibiltyInAutumn, 0, 100); } myTarget.winter = EditorGUILayout.Toggle("Winter", myTarget.winter); if (myTarget.winter) { myTarget.possibiltyInWinter = EditorGUILayout.Slider("Winter Possibility", myTarget.possibiltyInWinter, 0, 100); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); // Clouds Setup GUI.backgroundColor = boxColor1; GUILayout.BeginVertical("", boxStyleModified); GUI.backgroundColor = Color.white; showClouds = GUILayout.Toggle(showClouds, "Clouds Configs", headerFoldout); if (showClouds) { //Add Cloud Stuff #if ENVIRO_HD if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.HD) { GUILayout.BeginVertical("Volume Clouds", boxStyleModified); GUILayout.Space(20); myTarget.cloudsConfig.scatteringCoef = EditorGUILayout.Slider("Direct Light Intensity", myTarget.cloudsConfig.scatteringCoef, 0f, 2f); myTarget.cloudsConfig.ambientSkyColorIntensity = EditorGUILayout.Slider("Ambient Color Intensity", myTarget.cloudsConfig.ambientSkyColorIntensity, 0f, 2f); GUILayout.Space(10); myTarget.cloudsConfig.edgeDarkness = EditorGUILayout.Slider("Powder Term Intensity", myTarget.cloudsConfig.edgeDarkness, 0.4f, 0.99f); myTarget.cloudsConfig.lightAbsorbtion = EditorGUILayout.Slider("Light Absorbtion", myTarget.cloudsConfig.lightAbsorbtion, 0.0f, 1f); myTarget.cloudsConfig.lightStepModifier = EditorGUILayout.Slider("Light Step Modifier", myTarget.cloudsConfig.lightStepModifier, 0.01f, 2.0f); myTarget.cloudsConfig.lightVariance = EditorGUILayout.Slider("Light Variance Intensity", myTarget.cloudsConfig.lightVariance, 0.0f, 1.0f); GUILayout.Space(10); myTarget.cloudsConfig.density = EditorGUILayout.Slider("Density", myTarget.cloudsConfig.density, 0.1f, 4f); GUILayout.Space(10); myTarget.cloudsConfig.baseErosionIntensity = EditorGUILayout.Slider("Base Erosion Intensity", myTarget.cloudsConfig.baseErosionIntensity, 0f, 1f); myTarget.cloudsConfig.detailErosionIntensity = EditorGUILayout.Slider("Detail Erosion Intensity", myTarget.cloudsConfig.detailErosionIntensity, 0f, 1f); GUILayout.Space(10); myTarget.cloudsConfig.coverage = EditorGUILayout.Slider("Coverage", myTarget.cloudsConfig.coverage, -1f, 1f); myTarget.cloudsConfig.coverageType = EditorGUILayout.Slider("Coverage Type", myTarget.cloudsConfig.coverageType, 0f, 1f); myTarget.cloudsConfig.cloudType = EditorGUILayout.Slider("Cloud Type", myTarget.cloudsConfig.cloudType, 0f, 1f); GUILayout.Space(10); myTarget.cloudsConfig.raymarchingScale = EditorGUILayout.Slider("Raymarch Step Modifier", myTarget.cloudsConfig.raymarchingScale, 0.25f, 2f); EditorGUILayout.EndVertical(); } #endif GUILayout.BeginVertical("Flat Clouds", boxStyleModified); GUILayout.Space(20); myTarget.cloudsConfig.flatCoverage = EditorGUILayout.Slider("Flat Clouds Coverage", myTarget.cloudsConfig.flatCoverage, 0f, 2f); GUILayout.Space(5); myTarget.cloudsConfig.flatCloudsDensity = EditorGUILayout.Slider("Flat Clouds Density", myTarget.cloudsConfig.flatCloudsDensity, 0f, 5f); myTarget.cloudsConfig.flatCloudsAbsorbtion = EditorGUILayout.Slider("Flat Clouds Absorbtion", myTarget.cloudsConfig.flatCloudsAbsorbtion, 0f, 10f); myTarget.cloudsConfig.flatCloudsDirectLightIntensity = EditorGUILayout.Slider("Flat Clouds Direct Light Intensity", myTarget.cloudsConfig.flatCloudsDirectLightIntensity, 0f, 100f); myTarget.cloudsConfig.flatCloudsAmbientLightIntensity = EditorGUILayout.Slider("Flat Clouds Ambient Light Intensity", myTarget.cloudsConfig.flatCloudsAmbientLightIntensity, 0.0f, 2f); myTarget.cloudsConfig.flatCloudsHGPhase = EditorGUILayout.Slider("Flat Clouds HG Phase", myTarget.cloudsConfig.flatCloudsHGPhase, 0.0f, 1f); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Particle Clouds", boxStyleModified); GUILayout.Space(20); #if ENVIRO_HD if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.HD) { myTarget.cloudsConfig.particleCloudsOverwrite = EditorGUILayout.Toggle("Enable Particle Clouds Overwrite", myTarget.cloudsConfig.particleCloudsOverwrite); GUILayout.Space(10); } #endif myTarget.cloudsConfig.particleLayer1Alpha = EditorGUILayout.Slider("Layer 1 Alpha", myTarget.cloudsConfig.particleLayer1Alpha, 0f, 1f); myTarget.cloudsConfig.particleLayer1Brightness = EditorGUILayout.Slider("Layer 1 Brightness", myTarget.cloudsConfig.particleLayer1Brightness, 0f, 1f); myTarget.cloudsConfig.particleLayer1ColorPow = EditorGUILayout.Slider("Layer 1 Color Power", myTarget.cloudsConfig.particleLayer1ColorPow, 0.1f, 5f); GUILayout.Space(20); myTarget.cloudsConfig.particleLayer2Alpha = EditorGUILayout.Slider("Layer 2 Alpha", myTarget.cloudsConfig.particleLayer2Alpha, 0f, 1f); myTarget.cloudsConfig.particleLayer2Brightness = EditorGUILayout.Slider("Layer 2 Brightness", myTarget.cloudsConfig.particleLayer2Brightness, 0f, 1f); myTarget.cloudsConfig.particleLayer2ColorPow = EditorGUILayout.Slider("Layer 2 Color Power", myTarget.cloudsConfig.particleLayer2ColorPow, 0.1f, 5f); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Cirrus Clouds", boxStyleModified); GUILayout.Space(20); myTarget.cloudsConfig.cirrusAlpha = EditorGUILayout.Slider("Cirrus Clouds Alpha", myTarget.cloudsConfig.cirrusAlpha, 0f, 1f); myTarget.cloudsConfig.cirrusCoverage = EditorGUILayout.Slider("Cirrus Clouds Coverage", myTarget.cloudsConfig.cirrusCoverage, 0f, 1f); myTarget.cloudsConfig.cirrusColorPow = EditorGUILayout.Slider("Cirrus Clouds Color Power", myTarget.cloudsConfig.cirrusColorPow, 0.1f, 5f); EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); // Fog Setup GUI.backgroundColor = boxColor1; GUILayout.BeginVertical("", boxStyleModified); GUI.backgroundColor = Color.white; showFog = GUILayout.Toggle(showFog, "Fog Configs", headerFoldout); if (showFog) { GUILayout.BeginVertical("Fog Intensity", boxStyleModified); GUILayout.Space(15); GUILayout.BeginVertical("Linear", boxStyleModified); GUILayout.Space(15); myTarget.fogStartDistance = EditorGUILayout.FloatField("Start Distance", myTarget.fogStartDistance); myTarget.fogDistance = EditorGUILayout.FloatField("End Distance", myTarget.fogDistance); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("EXP", boxStyleModified); GUILayout.Space(15); myTarget.fogDensity = EditorGUILayout.FloatField("Density", myTarget.fogDensity); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Height", boxStyleModified); GUILayout.Space(15); myTarget.heightFogDensity = EditorGUILayout.Slider("Height Fog Density", myTarget.heightFogDensity, 0f, 10f); EditorGUILayout.EndVertical(); #if ENVIRO_HDRP GUILayout.BeginVertical("HDRP", boxStyleModified); GUILayout.Space(15); myTarget.fogAttenuationDistance = EditorGUILayout.Slider("Attenuation Distance", myTarget.fogAttenuationDistance, 1f, 10000f); myTarget.fogRelativeFogHeight = EditorGUILayout.Slider("Relative Fog Height", myTarget.fogRelativeFogHeight, -1000f, 1000f); EditorGUILayout.EndVertical(); #endif EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Advanced", boxStyleModified); GUILayout.Space(15); GUILayout.BeginVertical("", boxStyleModified); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(fogMod, true, null); if (EditorGUI.EndChangeCheck()) { serializedObj.ApplyModifiedProperties(); } myTarget.FogScatteringIntensity = EditorGUILayout.Slider("Scattering Intensity", myTarget.FogScatteringIntensity, 1f, 10f); myTarget.fogSunBlocking = EditorGUILayout.Slider("Sundisk Intensity", myTarget.fogSunBlocking, 0f, 1f); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Sky Fog", boxStyleModified); GUILayout.Space(15); myTarget.skyFogStart = EditorGUILayout.Slider("Sky Fog Start", myTarget.skyFogStart, 0f, 0.2f); myTarget.SkyFogHeight = EditorGUILayout.Slider("Sky Fog Height", myTarget.SkyFogHeight, 0f, 5f); myTarget.SkyFogIntensity = EditorGUILayout.Slider("Sky Fog Intensity", myTarget.SkyFogIntensity, 0f, 1f); #if ENVIRO_LW if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.LW) { myTarget.moonIntensity = EditorGUILayout.Slider("Moon Intensity", myTarget.moonIntensity, 0.0f, 1f); } #endif EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); #if ENVIRO_HD if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.HD) { GUI.backgroundColor = boxColor1; GUILayout.BeginVertical("", boxStyleModified); GUI.backgroundColor = Color.white; showPostProcessing = GUILayout.Toggle(showPostProcessing, "Distance Blur Configs", headerFoldout); if (showPostProcessing) { GUILayout.BeginVertical("", boxStyleModified); myTarget.blurDistance = EditorGUILayout.Slider("Blur Distance", myTarget.blurDistance, 0f, 5000f); myTarget.blurIntensity = EditorGUILayout.Slider("Blur Intensity", myTarget.blurIntensity, 0f, 1f); myTarget.blurSkyIntensity = EditorGUILayout.Slider("Sky Blur Intensity", myTarget.blurSkyIntensity, 0f, 5f); EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); } #endif // Audio Setup GUI.backgroundColor = boxColor1; GUILayout.BeginVertical("", boxStyleModified); GUI.backgroundColor = Color.white; showAudio = GUILayout.Toggle(showAudio, "Audio Configs", headerFoldout); if (showAudio) { GUILayout.BeginVertical("", boxStyleModified); myTarget.weatherSFX = (AudioClip)EditorGUILayout.ObjectField("Weather Soundeffect", myTarget.weatherSFX, typeof(AudioClip), true); GUILayout.Space(10); myTarget.SpringDayAmbient = (AudioClip)EditorGUILayout.ObjectField("Spring Day Ambient", myTarget.SpringDayAmbient, typeof(AudioClip), true); myTarget.SpringNightAmbient = (AudioClip)EditorGUILayout.ObjectField("Spring Night Ambient", myTarget.SpringNightAmbient, typeof(AudioClip), true); GUILayout.Space(10); myTarget.SummerDayAmbient = (AudioClip)EditorGUILayout.ObjectField("Summer Day Ambient", myTarget.SummerDayAmbient, typeof(AudioClip), true); myTarget.SummerNightAmbient = (AudioClip)EditorGUILayout.ObjectField("Summer Night Ambient", myTarget.SummerNightAmbient, typeof(AudioClip), true); GUILayout.Space(10); myTarget.AutumnDayAmbient = (AudioClip)EditorGUILayout.ObjectField("Autumn Day Ambient", myTarget.AutumnDayAmbient, typeof(AudioClip), true); myTarget.AutumnNightAmbient = (AudioClip)EditorGUILayout.ObjectField("Autumn Night Ambient", myTarget.AutumnNightAmbient, typeof(AudioClip), true); GUILayout.Space(10); myTarget.WinterDayAmbient = (AudioClip)EditorGUILayout.ObjectField("Winter Day Ambient", myTarget.WinterDayAmbient, typeof(AudioClip), true); myTarget.WinterNightAmbient = (AudioClip)EditorGUILayout.ObjectField("Winter Night Ambient", myTarget.WinterNightAmbient, typeof(AudioClip), true); EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); #if AURA_IN_PROJECT // Third Party Setup GUI.backgroundColor = boxColor1; GUILayout.BeginVertical("", boxStyleModified); GUI.backgroundColor = Color.white; showThirdParty = GUILayout.Toggle(showThirdParty, "Third Party Integrations", headerFoldout); if (showThirdParty) { GUILayout.BeginVertical("Aura 2", boxStyleModified); GUILayout.Space(20); GUILayout.BeginVertical("", boxStyleModified); EditorGUILayout.LabelField("Set Aura2 settings for each weather preset here. Please also activate Aura 2 Integration in Enviro Sky Manager -> Third Party Integration!", wrapStyle2); //myTarget.auraPreset = (Aura2API.AuraBaseSettings)EditorGUILayout.ObjectField("Aura 2 Preset", myTarget.auraPreset, typeof(Aura2API.AuraBaseSettings), true); myTarget.enviroAura2Config.aura2GlobalDensity = EditorGUILayout.Slider("Global Density", myTarget.enviroAura2Config.aura2GlobalDensity, 0f, 10f); myTarget.enviroAura2Config.aura2GlobalScattering = EditorGUILayout.Slider("Global Scattering", myTarget.enviroAura2Config.aura2GlobalScattering, 0f, 1f); myTarget.enviroAura2Config.aura2GlobalAmbientLight = EditorGUILayout.Slider("Global Ambient Light", myTarget.enviroAura2Config.aura2GlobalAmbientLight, 0f, 10f); myTarget.enviroAura2Config.aura2GlobalExtinction = EditorGUILayout.Slider("Global Extiction", myTarget.enviroAura2Config.aura2GlobalExtinction, 0f, 1f); EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); #endif // END EditorGUILayout.EndVertical(); EditorUtility.SetDirty(target); }
public override void OnInspectorGUI() { myTarget = (EnviroWeatherPreset)target; #if UNITY_5_6_OR_NEWER serializedObj.UpdateIfRequiredOrScript(); #else serializedObj.UpdateIfDirtyOrScript(); #endif //Set up the box style if (boxStyle == null) { boxStyle = new GUIStyle(GUI.skin.box); boxStyle.normal.textColor = GUI.skin.label.normal.textColor; boxStyle.fontStyle = FontStyle.Bold; boxStyle.alignment = TextAnchor.UpperLeft; } if (boxStyle2 == null) { boxStyle2 = new GUIStyle(GUI.skin.label); boxStyle2.normal.textColor = GUI.skin.label.normal.textColor; boxStyle2.fontStyle = FontStyle.Bold; boxStyle2.alignment = TextAnchor.UpperLeft; } //Setup the wrap style if (wrapStyle == null) { wrapStyle = new GUIStyle(GUI.skin.label); wrapStyle.fontStyle = FontStyle.Bold; wrapStyle.wordWrap = true; } if (clearStyle == null) { clearStyle = new GUIStyle(GUI.skin.label); clearStyle.normal.textColor = GUI.skin.label.normal.textColor; clearStyle.fontStyle = FontStyle.Bold; clearStyle.alignment = TextAnchor.UpperRight; } // Begin GUILayout.BeginVertical("", boxStyle); GUILayout.Space(10); myTarget.Name = EditorGUILayout.TextField("Name", myTarget.Name); GUILayout.Space(10); // General Setup GUILayout.BeginVertical("", boxStyle); showGeneral = EditorGUILayout.BeginToggleGroup("General Configs", showGeneral); if (showGeneral) { GUILayout.BeginVertical("Sky and Light Color", boxStyle); GUILayout.Space(15); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(skyMod, true, null); EditorGUILayout.PropertyField(lightMod, true, null); myTarget.volumeLightIntensity = EditorGUILayout.Slider("Volume Light Intensity", myTarget.volumeLightIntensity, 0, 2); myTarget.shadowIntensityMod = EditorGUILayout.Slider("Shadow Intensity Mod", myTarget.shadowIntensityMod, -1f, 1f); if (EditorGUI.EndChangeCheck()) { serializedObj.ApplyModifiedProperties(); } EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Weather Condition", boxStyle); GUILayout.Space(15); myTarget.WindStrenght = EditorGUILayout.Slider("Wind Intensity", myTarget.WindStrenght, 0f, 1f); myTarget.wetnessLevel = EditorGUILayout.Slider("Maximum Wetness", myTarget.wetnessLevel, 0f, 1f); myTarget.snowLevel = EditorGUILayout.Slider("Maximum Snow", myTarget.snowLevel, 0f, 1f); myTarget.temperatureLevel = EditorGUILayout.Slider("Temperature Modification", myTarget.temperatureLevel, -50f, 50f); myTarget.isLightningStorm = EditorGUILayout.Toggle("Lightning Storm", myTarget.isLightningStorm); myTarget.lightningInterval = EditorGUILayout.Slider("Lightning Interval", myTarget.lightningInterval, 2f, 60f); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Particle Effects", boxStyle); GUILayout.Space(15); if (!Application.isPlaying) { if (GUILayout.Button("Add")) { myTarget.effectSystems.Add(new EnviroWeatherEffects()); } } else { EditorGUILayout.LabelField("Can't add effects in runtime!"); } for (int i = 0; i < myTarget.effectSystems.Count; i++) { GUILayout.BeginVertical("Effect " + (i + 1), boxStyle); GUILayout.Space(15); myTarget.effectSystems[i].prefab = (GameObject)EditorGUILayout.ObjectField("Effect Prefab", myTarget.effectSystems[i].prefab, typeof(GameObject), true); myTarget.effectSystems [i].localPositionOffset = EditorGUILayout.Vector3Field("Position Offset", myTarget.effectSystems [i].localPositionOffset); myTarget.effectSystems [i].localRotationOffset = EditorGUILayout.Vector3Field("Rotation Offset", myTarget.effectSystems [i].localRotationOffset); if (GUILayout.Button("Remove")) { myTarget.effectSystems.Remove(myTarget.effectSystems[i]); } GUILayout.EndVertical(); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); // Season Setup GUILayout.BeginVertical("", boxStyle); showSeason = EditorGUILayout.BeginToggleGroup("Season Configs", showSeason); if (showSeason) { myTarget.Spring = EditorGUILayout.Toggle("Spring", myTarget.Spring); if (myTarget.Spring) { myTarget.possibiltyInSpring = EditorGUILayout.Slider("Spring Possibility", myTarget.possibiltyInSpring, 0, 100); } myTarget.Summer = EditorGUILayout.Toggle("Summer", myTarget.Summer); if (myTarget.Summer) { myTarget.possibiltyInSummer = EditorGUILayout.Slider("Summer Possibility", myTarget.possibiltyInSummer, 0, 100); } myTarget.Autumn = EditorGUILayout.Toggle("Autumn", myTarget.Autumn); if (myTarget.Autumn) { myTarget.possibiltyInAutumn = EditorGUILayout.Slider("Autumn Possibility", myTarget.possibiltyInAutumn, 0, 100); } myTarget.winter = EditorGUILayout.Toggle("Winter", myTarget.winter); if (myTarget.winter) { myTarget.possibiltyInWinter = EditorGUILayout.Slider("Winter Possibility", myTarget.possibiltyInWinter, 0, 100); } //Add Content } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); // Clouds Setup GUILayout.BeginVertical("", boxStyle); showClouds = EditorGUILayout.BeginToggleGroup("Clouds Configs", showClouds); if (showClouds) { //Add Cloud Stuff #if ENVIRO_HD if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.HD) { GUILayout.BeginVertical("Volume Clouds", boxStyle); GUILayout.Space(20); myTarget.cloudsConfig.scatteringCoef = EditorGUILayout.Slider("Direct Light Intensity", myTarget.cloudsConfig.scatteringCoef, 0f, 2f); myTarget.cloudsConfig.ambientSkyColorIntensity = EditorGUILayout.Slider("Ambient Color Intensity", myTarget.cloudsConfig.ambientSkyColorIntensity, 0.0f, 1f); myTarget.cloudsConfig.density = EditorGUILayout.Slider("Density", myTarget.cloudsConfig.density, 1f, 10f); GUILayout.Space(10); myTarget.cloudsConfig.coverage = EditorGUILayout.Slider("Coverage", myTarget.cloudsConfig.coverage, -1f, 2f); GUILayout.Space(10); myTarget.cloudsConfig.coverageModTop = EditorGUILayout.Slider("Coverage Top Modificator", myTarget.cloudsConfig.coverageModTop, 0f, 1f); myTarget.cloudsConfig.coverageModBottom = EditorGUILayout.Slider("Coverage Bottom Modificator", myTarget.cloudsConfig.coverageModBottom, 0f, 1f); GUILayout.Space(10); myTarget.cloudsConfig.coverageType = EditorGUILayout.Slider("Coverage Type", myTarget.cloudsConfig.coverageType, 0f, 1f); myTarget.cloudsConfig.cloudType = EditorGUILayout.Slider("Cloud Type", myTarget.cloudsConfig.cloudType, 0f, 1f); GUILayout.Space(10); myTarget.cloudsConfig.raymarchingScale = EditorGUILayout.Slider("Raymarch Step Modifier", myTarget.cloudsConfig.raymarchingScale, 0.25f, 1f); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Flat Clouds", boxStyle); GUILayout.Space(20); myTarget.cloudsConfig.flatAlpha = EditorGUILayout.Slider("Flat Clouds Alpha", myTarget.cloudsConfig.flatAlpha, 1f, 2f); myTarget.cloudsConfig.flatCoverage = EditorGUILayout.Slider("Flat Clouds Coverage", myTarget.cloudsConfig.flatCoverage, 0f, 1f); myTarget.cloudsConfig.flatSoftness = EditorGUILayout.Slider("Flat Clouds Softness", myTarget.cloudsConfig.flatSoftness, 0f, 1f); myTarget.cloudsConfig.flatBrightness = EditorGUILayout.Slider("Flat Clouds Brighness", myTarget.cloudsConfig.flatBrightness, 0f, 1f); myTarget.cloudsConfig.flatColorPow = EditorGUILayout.Slider("Flat Clouds Color Power", myTarget.cloudsConfig.flatColorPow, 0.1f, 5f); EditorGUILayout.EndVertical(); } #endif GUILayout.BeginVertical("Particle Clouds", boxStyle); GUILayout.Space(20); #if ENVIRO_HD if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.HD) { myTarget.cloudsConfig.particleCloudsOverwrite = EditorGUILayout.Toggle("Enable Particle Clouds Overwrite", myTarget.cloudsConfig.particleCloudsOverwrite); GUILayout.Space(10); } #endif myTarget.cloudsConfig.particleLayer1Alpha = EditorGUILayout.Slider("Layer 1 Alpha", myTarget.cloudsConfig.particleLayer1Alpha, 0f, 1f); myTarget.cloudsConfig.particleLayer1Brightness = EditorGUILayout.Slider("Layer 1 Brightness", myTarget.cloudsConfig.particleLayer1Brightness, 0f, 1f); myTarget.cloudsConfig.particleLayer1ColorPow = EditorGUILayout.Slider("Layer 1 Color Power", myTarget.cloudsConfig.particleLayer1ColorPow, 0.1f, 5f); GUILayout.Space(20); myTarget.cloudsConfig.particleLayer2Alpha = EditorGUILayout.Slider("Layer 2 Alpha", myTarget.cloudsConfig.particleLayer2Alpha, 0f, 1f); myTarget.cloudsConfig.particleLayer2Brightness = EditorGUILayout.Slider("Layer 2 Brightness", myTarget.cloudsConfig.particleLayer2Brightness, 0f, 1f); myTarget.cloudsConfig.particleLayer2ColorPow = EditorGUILayout.Slider("Layer 2 Color Power", myTarget.cloudsConfig.particleLayer2ColorPow, 0.1f, 5f); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Cirrus Clouds", boxStyle); GUILayout.Space(20); myTarget.cloudsConfig.cirrusAlpha = EditorGUILayout.Slider("Cirrus Clouds Alpha", myTarget.cloudsConfig.cirrusAlpha, 0f, 1f); myTarget.cloudsConfig.cirrusCoverage = EditorGUILayout.Slider("Cirrus Clouds Coverage", myTarget.cloudsConfig.cirrusCoverage, 0f, 1f); myTarget.cloudsConfig.cirrusColorPow = EditorGUILayout.Slider("Cirrus Clouds Color Power", myTarget.cloudsConfig.cirrusColorPow, 0.1f, 5f); EditorGUILayout.EndVertical(); } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); // Fog Setup GUILayout.BeginVertical("", boxStyle); showFog = EditorGUILayout.BeginToggleGroup("Fog Configs", showFog); if (showFog) { GUILayout.BeginVertical("Fog Intensity", boxStyle); GUILayout.Space(15); GUILayout.BeginVertical("Linear", boxStyle2); GUILayout.Space(15); myTarget.fogStartDistance = EditorGUILayout.FloatField("Start Distance", myTarget.fogStartDistance); myTarget.fogDistance = EditorGUILayout.FloatField("End Distance", myTarget.fogDistance); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("EXP", boxStyle2); GUILayout.Space(15); myTarget.fogDensity = EditorGUILayout.FloatField("Density", myTarget.fogDensity); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Height", boxStyle2); GUILayout.Space(15); myTarget.heightFogDensity = EditorGUILayout.Slider("Height Fog Density", myTarget.heightFogDensity, 0f, 10f); EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); GUILayout.BeginVertical("Advanced", boxStyle); GUILayout.Space(15); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(fogMod, true, null); if (EditorGUI.EndChangeCheck()) { serializedObj.ApplyModifiedProperties(); } myTarget.FogScatteringIntensity = EditorGUILayout.Slider("Scattering Intensity", myTarget.FogScatteringIntensity, 1f, 10f); myTarget.fogSunBlocking = EditorGUILayout.Slider("Sundisk Intensity", myTarget.fogSunBlocking, 0f, 1f); GUILayout.BeginVertical("Sky Fog", boxStyle2); GUILayout.Space(15); myTarget.SkyFogHeight = EditorGUILayout.Slider("Sky Fog Height", myTarget.SkyFogHeight, 0f, 5f); myTarget.SkyFogIntensity = EditorGUILayout.Slider("Sky Fog Intensity", myTarget.SkyFogIntensity, 0f, 1f); #if ENVIRO_LW if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.LW) { myTarget.moonIntensity = EditorGUILayout.Slider("Moon Intensity", myTarget.moonIntensity, 0.0f, 1f); } #endif EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); //Add Content } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); #if ENVIRO_HD if (EnviroSkyMgr.instance == null || EnviroSkyMgr.instance.currentEnviroSkyVersion == EnviroSkyMgr.EnviroSkyVersion.HD) { GUILayout.BeginVertical("", boxStyle); showPostProcessing = EditorGUILayout.BeginToggleGroup("Distance Blur Configs", showPostProcessing); if (showPostProcessing) { myTarget.blurDistance = EditorGUILayout.Slider("Blur Distance", myTarget.blurDistance, 0f, 5000f); myTarget.blurIntensity = EditorGUILayout.Slider("Blur Intensity", myTarget.blurIntensity, 0f, 1f); myTarget.blurSkyIntensity = EditorGUILayout.Slider("Sky Blur Intensity", myTarget.blurSkyIntensity, 0f, 5f); } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); } #endif // Audio Setup GUILayout.BeginVertical("", boxStyle); showAudio = EditorGUILayout.BeginToggleGroup("Audio Configs", showAudio); if (showAudio) { myTarget.weatherSFX = (AudioClip)EditorGUILayout.ObjectField("Weather Soundeffect", myTarget.weatherSFX, typeof(AudioClip), true); GUILayout.Space(10); myTarget.SpringDayAmbient = (AudioClip)EditorGUILayout.ObjectField("Spring Day Ambient", myTarget.SpringDayAmbient, typeof(AudioClip), true); myTarget.SpringNightAmbient = (AudioClip)EditorGUILayout.ObjectField("Spring Night Ambient", myTarget.SpringNightAmbient, typeof(AudioClip), true); GUILayout.Space(10); myTarget.SummerDayAmbient = (AudioClip)EditorGUILayout.ObjectField("Summer Day Ambient", myTarget.SummerDayAmbient, typeof(AudioClip), true); myTarget.SummerNightAmbient = (AudioClip)EditorGUILayout.ObjectField("Summer Night Ambient", myTarget.SummerNightAmbient, typeof(AudioClip), true); GUILayout.Space(10); myTarget.AutumnDayAmbient = (AudioClip)EditorGUILayout.ObjectField("Autumn Day Ambient", myTarget.AutumnDayAmbient, typeof(AudioClip), true); myTarget.AutumnNightAmbient = (AudioClip)EditorGUILayout.ObjectField("Autumn Night Ambient", myTarget.AutumnNightAmbient, typeof(AudioClip), true); GUILayout.Space(10); myTarget.WinterDayAmbient = (AudioClip)EditorGUILayout.ObjectField("Winter Day Ambient", myTarget.WinterDayAmbient, typeof(AudioClip), true); myTarget.WinterNightAmbient = (AudioClip)EditorGUILayout.ObjectField("Winter Night Ambient", myTarget.WinterNightAmbient, typeof(AudioClip), true); //Add Content } EditorGUILayout.EndToggleGroup(); EditorGUILayout.EndVertical(); // END EditorGUILayout.EndVertical(); EditorUtility.SetDirty(target); }