private static void EnviroSky_AssignAndStart(EnviroSky __instance, GameObject player, Camera Camera) { _playerObject = player; _playerCamera = Camera; CameraOptimizations.InitializeCamera(Camera, 0.1f, 10000f); LightOptimizations.InitializeLighting(__instance.Components.DirectLight.GetComponent <Light>(), 10000f); CameraOptimizations.UpdateCameraSphericalCulling(_sphericalCulling.Value); CameraOptimizations.UpdateCameraFarClipPlane(GameLayers.Layer.CharaLayer, _characterClipDistance.Value); CameraOptimizations.UpdateCameraFarClipPlane(GameLayers.Layer.MapLayer, _worldClipDistance.Value); CameraOptimizations.UpdateCameraFarClipPlane(GameLayers.Layer.MediumObjectLayer, _mediumClipDistance.Value); CameraOptimizations.UpdateCameraFarClipPlane(GameLayers.Layer.SmallObjectLayer, _smallClipDistance.Value); CameraOptimizations.UpdateCameraFarClipPlane(GameLayers.Layer.LargeObjectLayer, _terrainClipDistance.Value); CameraOptimizations.UpdateCameraFarClipPlane(GameLayers.Layer.WaterLayer, _waterClipDistance.Value); LightOptimizations.UpdateShadowClipPlane((int)GameLayers.Layer.CharaLayer, _characterShadowDistance.Value); LightOptimizations.UpdateShadowClipPlane((int)GameLayers.Layer.MapLayer, _worldShadowDistance.Value); LightOptimizations.UpdateShadowClipPlane((int)GameLayers.Layer.MediumObjectLayer, _mediumShadowDistance.Value); LightOptimizations.UpdateShadowClipPlane((int)GameLayers.Layer.SmallObjectLayer, _smallShadowDistance.Value); LightOptimizations.UpdateShadowClipPlane((int)GameLayers.Layer.LargeObjectLayer, _largeShadowDistance.Value); LightOptimizations.UpdateShadowClipPlane((int)GameLayers.Layer.WaterLayer, _waterShadowDistance.Value); QualitySettings.shadowProjection = _shadowProjection.Value; QualitySettings.shadowDistance = _shadowDistance.Value; QualitySettings.lodBias = _LODBias.Value; QualitySettings.maximumLODLevel = _maximumLOD.Value; }
static void Draw_Settings_Atmospheric(GraphicSystem data, bool draw = true) { if (!data.Atmospheric || Map.Instance.Simulator == null) { return; } EnviroSky sky = Map.Instance.Simulator.EnviroSky; EnviroFogSettings fog = sky.fogSettings; EnviroLightshafts light = sky.LightShafts; fog.distanceFog = Field("Distance Fog", fog.distanceFog, draw); fog.heightFog = Field("Height Fog", fog.heightFog, draw); sky.volumeLighting = Field("Volume Lighting", sky.volumeLighting, draw); light.sunLightShafts = Field("Sun Light Shafts", light.sunLightShafts, draw); light.moonLightShafts = Field("Moon Light Shafts", light.moonLightShafts, draw); }
internal static void EnviroSky_LateUpdate(EnviroSky __instance, Light ___MainLight) { if (_ambient_mode.Value != RenderSettings.ambientMode) { __instance.lightSettings.ambientMode = _ambient_mode.Value; RenderSettings.ambientMode = _ambient_mode.Value; } if (_dhh_override.Value) { ___MainLight.intensity = directLightIntensity; ___MainLight.shadowStrength = directLightShadowStrength; ApplyAmbientIntensities(__instance.GameTime.solarTime); } if (++updateLightCount > _portableLampUpdateRate.Value) { AdjustPortableLights(); updateLightCount = 0; } }
internal static void EnviroSky_Update(EnviroSky __instance) { if (__instance.profile == null || !__instance.started || __instance.serverMode) { return; } float solarTime = __instance.GameTime.solarTime; if (solarTime > 0.45) { directLightIntensity = (__instance.MainLight.intensity * _sun_intensity_multipier.Value) + _sun_intensity_offset.Value; directLightShadowStrength = __instance.MainLight.shadowStrength * _sun_shadow_multipier.Value; } else if (solarTime > 0.4) { float sunIntensity = (solarTime - 0.4f) * 20f; float lunarIntensity = 1 - sunIntensity; directLightIntensity = (((__instance.lightSettings.directLightSunIntensity.Evaluate(solarTime) * _sun_intensity_multipier.Value) + _sun_intensity_offset.Value) * sunIntensity) + (((__instance.lightSettings.directLightMoonIntensity.Evaluate(__instance.GameTime.lunarTime) * _moon_intensity_multipier.Value) + _moon_intensity_offset.Value) * lunarIntensity); directLightShadowStrength = __instance.MainLight.shadowStrength * (_sun_shadow_multipier.Value * sunIntensity + _moon_shadow_multipier.Value * lunarIntensity); __instance.Components.DirectLight.rotation = Quaternion.Lerp(__instance.Components.Moon.transform.rotation, __instance.Components.Sun.transform.rotation, sunIntensity); } else { directLightIntensity = (__instance.MainLight.intensity * _moon_intensity_multipier.Value) + _moon_intensity_offset.Value; directLightShadowStrength = __instance.MainLight.shadowStrength * _moon_shadow_multipier.Value; } var currentWeather = Singleton <Manager.Game> .Instance?.Environment?.Weather; if (currentWeather != null) { float intensityMultiplier = 1.0f; if (currentWeather == AIProject.Weather.Cloud1) { intensityMultiplier = _cloud1_intensity_multiplier.Value; } else if (currentWeather == AIProject.Weather.Cloud2) { intensityMultiplier = _cloud2_intensity_multiplier.Value; } else if (currentWeather == AIProject.Weather.Cloud3) { intensityMultiplier = _cloud3_intensity_multiplier.Value; } else if (currentWeather == AIProject.Weather.Cloud4) { intensityMultiplier = _cloud4_intensity_multiplier.Value; } else if (currentWeather == AIProject.Weather.Fog) { intensityMultiplier = _fog_intensity_multiplier.Value; } else if (currentWeather == AIProject.Weather.Rain) { intensityMultiplier = _rain_intensity_multiplier.Value; } else if (currentWeather == AIProject.Weather.Storm) { intensityMultiplier = _storm_intensity_multiplier.Value; } directLightIntensity *= intensityMultiplier; directLightShadowStrength *= intensityMultiplier; } if (RenderSettings.ambientMode == AmbientMode.Trilight) { ambientSkyColor = RenderSettings.ambientSkyColor; ambientEquatorColor = RenderSettings.ambientEquatorColor; ambientGroundColor = RenderSettings.ambientGroundColor; } else { ambientIntensity = RenderSettings.ambientIntensity; if (RenderSettings.ambientMode == AmbientMode.Skybox && (solarTime < 0.5 && solarTime > 0.4) && (nextAmbientSkyUpdate < __instance.internalHour || nextAmbientSkyUpdate > __instance.internalHour + 0.011f)) { DynamicGI.UpdateEnvironment(); nextAmbientSkyUpdate = __instance.internalHour + 0.01f; } } if (!_dhh_override.Value) { __instance.MainLight.intensity = directLightIntensity; __instance.MainLight.shadowStrength = directLightShadowStrength; ApplyAmbientIntensities(solarTime); } }
private void Refresh() { GraphicSystem graphicData = Manager.Config.GraphicData; using (List <Bloom> .Enumerator enumerator = this._bloom.GetEnumerator()) { while (enumerator.MoveNext()) { Bloom current = enumerator.Current; if (((PostProcessEffectSettings)current).active != (graphicData.Bloom ? 1 : 0)) { ((PostProcessEffectSettings)current).active = (__Null)(graphicData.Bloom ? 1 : 0); } } } using (List <AmbientOcclusion> .Enumerator enumerator = this._ao.GetEnumerator()) { while (enumerator.MoveNext()) { AmbientOcclusion current = enumerator.Current; if (((PostProcessEffectSettings)current).active != (graphicData.SSAO ? 1 : 0)) { ((PostProcessEffectSettings)current).active = (__Null)(graphicData.SSAO ? 1 : 0); } } } using (List <ScreenSpaceReflections> .Enumerator enumerator = this._ssr.GetEnumerator()) { while (enumerator.MoveNext()) { ScreenSpaceReflections current = enumerator.Current; if (((PostProcessEffectSettings)current).active != (graphicData.SSR ? 1 : 0)) { ((PostProcessEffectSettings)current).active = (__Null)(graphicData.SSR ? 1 : 0); } } } using (List <DepthOfField> .Enumerator enumerator = this._dof.GetEnumerator()) { while (enumerator.MoveNext()) { DepthOfField current = enumerator.Current; if (((PostProcessEffectSettings)current).active != (graphicData.DepthOfField ? 1 : 0)) { ((PostProcessEffectSettings)current).active = (__Null)(graphicData.DepthOfField ? 1 : 0); } } } using (List <Vignette> .Enumerator enumerator = this._vignette.GetEnumerator()) { while (enumerator.MoveNext()) { Vignette current = enumerator.Current; if (((PostProcessEffectSettings)current).active != (graphicData.Vignette ? 1 : 0)) { ((PostProcessEffectSettings)current).active = (__Null)(graphicData.Vignette ? 1 : 0); } } } if (Singleton <Manager.Map> .IsInstance() && Object.op_Inequality((Object)Singleton <Manager.Map> .Instance.Simulator, (Object)null) && Object.op_Inequality((Object)Singleton <Manager.Map> .Instance.Simulator.EnviroSky, (Object)null)) { EnviroSky enviroSky = Singleton <Manager.Map> .Instance.Simulator.EnviroSky; enviroSky.fogSettings.distanceFog = graphicData.Atmospheric; enviroSky.fogSettings.heightFog = graphicData.Atmospheric; enviroSky.volumeLighting = graphicData.Atmospheric; enviroSky.LightShafts.sunLightShafts = graphicData.Atmospheric; enviroSky.LightShafts.moonLightShafts = graphicData.Atmospheric; } if (!Object.op_Inequality((Object)this.Wetstuff, (Object)null) || ((Behaviour)this.Wetstuff).get_enabled() == graphicData.Rain) { return; } ((Behaviour)this.Wetstuff).set_enabled(graphicData.Rain); }
public static void InitializeTime(EnviroSky sky) { enviroSky = sky; lastUpdateTime = enviroSky.internalHour; }
void OnEnable() { myTarget = (EnviroSky)target; serializedObj = new SerializedObject(myTarget); //Components Sun = serializedObj.FindProperty("Components.Sun"); Moon = serializedObj.FindProperty("Components.Moon"); Clouds = serializedObj.FindProperty("Components.Clouds"); DirectLight = serializedObj.FindProperty("Components.DirectLight"); GlobalReflectionProbe = serializedObj.FindProperty("Components.GlobalReflectionProbe"); windZone = serializedObj.FindProperty("Components.windZone"); LightningGenerator = serializedObj.FindProperty("Components.LightningGenerator"); satellites = serializedObj.FindProperty("Components.satellites"); starsRotation = serializedObj.FindProperty("Components.starsRotation"); /// Setup Player = serializedObj.FindProperty("Player"); Camera = serializedObj.FindProperty("PlayerCamera"); PlayerTag = serializedObj.FindProperty("PlayerTag"); CameraTag = serializedObj.FindProperty("CameraTag"); AssignOnRuntime = serializedObj.FindProperty("AssignInRuntime"); HDR = serializedObj.FindProperty("HDR"); SkyTag = serializedObj.FindProperty("skyRenderingLayer"); SatTag = serializedObj.FindProperty("satelliteRenderingLayer"); singlePassVR = serializedObj.FindProperty("singlePassVR"); setCameraClearFlags = serializedObj.FindProperty("setCameraClearFlags"); // Weather Controls UpdateWeather = serializedObj.FindProperty("Weather.updateWeather"); StartWeather = serializedObj.FindProperty("Weather.startWeatherPreset"); //Feature Controls: EnableFog = serializedObj.FindProperty("Fog.AdvancedFog"); EnableSunShafts = serializedObj.FindProperty("LightShafts.sunLightShafts"); EnableMoonShafts = serializedObj.FindProperty("LightShafts.moonLightShafts"); // Audio Controls AmbientVolume = serializedObj.FindProperty("Audio.ambientSFXVolume"); WeatherVolume = serializedObj.FindProperty("Audio.weatherSFXVolume"); // Time Controls ProgressMode = serializedObj.FindProperty("GameTime.ProgressTime"); DayLength = serializedObj.FindProperty("GameTime.DayLengthInMinutes"); NightLength = serializedObj.FindProperty("GameTime.NightLengthInMinutes"); UpdateSeason = serializedObj.FindProperty("Seasons.calcSeasons"); CurrentSeason = serializedObj.FindProperty("Seasons.currentSeasons"); Years = serializedObj.FindProperty("GameTime.Years"); Days = serializedObj.FindProperty("GameTime.Days"); Hours = serializedObj.FindProperty("GameTime.Hours"); Minutes = serializedObj.FindProperty("GameTime.Minutes"); Seconds = serializedObj.FindProperty("GameTime.Seconds"); Longitude = serializedObj.FindProperty("GameTime.Longitude"); Latitude = serializedObj.FindProperty("GameTime.Latitude"); UTC = serializedObj.FindProperty("GameTime.utcOffset"); //Lighting Category lightColorGradient = serializedObj.FindProperty("lightSettings.LightColor"); lightIntensityCurve = serializedObj.FindProperty("lightSettings.directLightIntensity"); shadowStrength = serializedObj.FindProperty("lightSettings.shadowStrength"); ambientMode = serializedObj.FindProperty("lightSettings.ambientMode"); ambientIntensityCurve = serializedObj.FindProperty("lightSettings.ambientIntensity"); ambientSkyGradient = serializedObj.FindProperty("lightSettings.ambientSkyColor"); ambientEquatorGradient = serializedObj.FindProperty("lightSettings.ambientEquatorColor"); ambientGroundGradient = serializedObj.FindProperty("lightSettings.ambientGroundColor"); reflectionBool = serializedObj.FindProperty("lightSettings.globalReflections"); reflectionIntensity = serializedObj.FindProperty("lightSettings.globalReflectionsIntensity"); reflectionUpdate = serializedObj.FindProperty("lightSettings.globalReflectionsUpdate"); //Sky Category skyboxMode = serializedObj.FindProperty("skySettings.skyboxMode"); customSkyboxMaterial = serializedObj.FindProperty("skySettings.customSkyboxMaterial"); customSkyboxColor = serializedObj.FindProperty("skySettings.customSkyboxColor"); rayleigh = serializedObj.FindProperty("skySettings.rayleigh"); g = serializedObj.FindProperty("skySettings.g"); mie = serializedObj.FindProperty("skySettings.mie"); scatteringCurve = serializedObj.FindProperty("skySettings.scatteringCurve"); scatteringColor = serializedObj.FindProperty("skySettings.scatteringColor"); sunMoonPos = serializedObj.FindProperty("skySettings.sunAndMoonPosition"); sunIntensity = serializedObj.FindProperty("skySettings.sunIntensity"); sunDiskScale = serializedObj.FindProperty("skySettings.sunDiskScale"); sunDiskIntensity = serializedObj.FindProperty("skySettings.sunDiskIntensity"); sunDiskColor = serializedObj.FindProperty("skySettings.sunDiskColor"); moonPhaseMode = serializedObj.FindProperty("skySettings.moonPhaseMode"); moonTexture = serializedObj.FindProperty("skySettings.moonTexture"); moonBrightness = serializedObj.FindProperty("skySettings.moonBrightness"); moonGlow = serializedObj.FindProperty("skySettings.moonGlow"); startMoonPhase = serializedObj.FindProperty("skySettings.startMoonPhase"); currentMoonPhase = serializedObj.FindProperty("customMoonPhase"); skyLuminance = serializedObj.FindProperty("skySettings.skyLuminence"); skyColorPower = serializedObj.FindProperty("skySettings.skyColorPower"); skyExposure = serializedObj.FindProperty("skySettings.skyExposure"); starsCubemap = serializedObj.FindProperty("skySettings.starsCubeMap"); starsIntensity = serializedObj.FindProperty("skySettings.starsIntensity"); //Clouds Category worldScale = serializedObj.FindProperty("cloudsSettings.worldScale"); fixedAltitude = serializedObj.FindProperty("cloudsSettings.FixedAltitude"); cloudsAltitude = serializedObj.FindProperty("cloudsSettings.cloudsAltitude"); cloudsRenderQuality = serializedObj.FindProperty("cloudsSettings.cloudsRenderResolution"); skyColor = serializedObj.FindProperty("cloudsSettings.skyColor"); sunHighlightColor = serializedObj.FindProperty("cloudsSettings.sunHighlightColor"); moonHighlightColor = serializedObj.FindProperty("cloudsSettings.moonHighlightColor"); lightIntensity = serializedObj.FindProperty("cloudsSettings.lightIntensity"); // Weather Category useTag = serializedObj.FindProperty("weatherSettings.useTag"); wetnessAccumulationSpeed = serializedObj.FindProperty("weatherSettings.wetnessAccumulationSpeed"); wetnessDryingSpeed = serializedObj.FindProperty("weatherSettings.wetnessDryingSpeed"); snowAccumulationSpeed = serializedObj.FindProperty("weatherSettings.snowAccumulationSpeed"); snowMeltingSpeed = serializedObj.FindProperty("weatherSettings.snowMeltingSpeed"); cloudTransitionSpeed = serializedObj.FindProperty("weatherSettings.cloudTransitionSpeed"); fogTransitionSpeed = serializedObj.FindProperty("weatherSettings.fogTransitionSpeed"); effectTransitionSpeed = serializedObj.FindProperty("weatherSettings.effectTransitionSpeed"); audioTransitionSpeed = serializedObj.FindProperty("weatherSettings.audioTransitionSpeed"); useWindZoneDirection = serializedObj.FindProperty("cloudsSettings.useWindZoneDirection"); renderClouds = serializedObj.FindProperty("cloudsSettings.renderClouds"); windTimeScale = serializedObj.FindProperty("cloudsSettings.cloudsTimeScale"); windIntensity = serializedObj.FindProperty("cloudsSettings.cloudsWindStrengthModificator"); windDirectionX = serializedObj.FindProperty("cloudsSettings.cloudsWindDirectionX"); windDirectionY = serializedObj.FindProperty("cloudsSettings.cloudsWindDirectionY"); fogmode = serializedObj.FindProperty("fogSettings.Fogmode"); distanceFog = serializedObj.FindProperty("fogSettings.distanceFog"); useRadialFog = serializedObj.FindProperty("fogSettings.useRadialDistance"); startDistance = serializedObj.FindProperty("fogSettings.startDistance"); distanceFogIntensity = serializedObj.FindProperty("fogSettings.distanceFogIntensity"); maximumFogIntensity = serializedObj.FindProperty("fogSettings.maximumFogDensity"); heightFog = serializedObj.FindProperty("fogSettings.heightFog"); height = serializedObj.FindProperty("fogSettings.height"); heightFogIntensity = serializedObj.FindProperty("fogSettings.heightFogIntensity"); noiseIntensity = serializedObj.FindProperty("fogSettings.noiseIntensity"); noiseScale = serializedObj.FindProperty("fogSettings.noiseScale"); fogDitheringScale = serializedObj.FindProperty("fogSettings.fogDitheringScale"); fogDitheringIntensity = serializedObj.FindProperty("fogSettings.fogDitheringIntensity"); //LightShafts resolution = serializedObj.FindProperty("lightshaftsSettings.resolution"); screenBlendMode = serializedObj.FindProperty("lightshaftsSettings.screenBlendMode"); useDepthTexture = serializedObj.FindProperty("lightshaftsSettings.useDepthTexture"); lightShaftsColorSun = serializedObj.FindProperty("lightshaftsSettings.lightShaftsColorSun"); lightShaftsColorMoon = serializedObj.FindProperty("lightshaftsSettings.lightShaftsColorMoon"); treshholdColorSun = serializedObj.FindProperty("lightshaftsSettings.thresholdColorSun"); treshholdColorMoon = serializedObj.FindProperty("lightshaftsSettings.thresholdColorMoon"); blurRadius = serializedObj.FindProperty("lightshaftsSettings.blurRadius"); shaftsIntensity = serializedObj.FindProperty("lightshaftsSettings.intensity"); maxRadius = serializedObj.FindProperty("lightshaftsSettings.maxRadius"); //Season daysInSpring = serializedObj.FindProperty("seasonsSettings.SpringInDays"); daysInSummer = serializedObj.FindProperty("seasonsSettings.SummerInDays"); daysInAutumn = serializedObj.FindProperty("seasonsSettings.AutumnInDays"); daysInWinter = serializedObj.FindProperty("seasonsSettings.WinterInDays"); //Background Rendering enableBGRendering = serializedObj.FindProperty("backgroundSettings.backgroundRendering"); bgRenderingLayer = serializedObj.FindProperty("backgroundSettings.backgroundLayer"); bgRenderingDistance = serializedObj.FindProperty("backgroundSettings.backgroundViewDistance"); //Quality effectQuality = serializedObj.FindProperty("qualitySettings.GlobalParticleEmissionRates"); updateInterval = serializedObj.FindProperty("qualitySettings.UpdateInterval"); //Audio thunderSFX = new ReorderableList(serializedObject, serializedObject.FindProperty("audioSettings.ThunderSFX"), true, true, true, true); thunderSFX.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "Thunder SFX"); }; thunderSFX.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { var element = thunderSFX.serializedProperty.GetArrayElementAtIndex(index); rect.y += 2; EditorGUI.PropertyField( new Rect(rect.x, rect.y, Screen.width * .8f, EditorGUIUtility.singleLineHeight), element, GUIContent.none); }; thunderSFX.onAddCallback = (ReorderableList l) => { var index = l.serializedProperty.arraySize; l.serializedProperty.arraySize++; l.index = index; //var element = l.serializedProperty.GetArrayElementAtIndex(index); }; modifiedColor = Color.red; modifiedColor.a = 0.5f; //// }
public override void OnInspectorGUI() { myTarget = (EnviroSky)target; //int daysInyear = (int)(myTarget.seasonsSettings.SpringInDays + myTarget.seasonsSettings.SummerInDays + myTarget.seasonsSettings.AutumnInDays + myTarget.seasonsSettings.WinterInDays); //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(GUI.skin.box); boxStyleModified.normal.textColor = GUI.skin.label.normal.textColor; boxStyleModified.fontStyle = FontStyle.Bold; boxStyleModified.alignment = TextAnchor.UpperLeft; } //Setup the wrap style if (wrapStyle == null) { wrapStyle = new GUIStyle(GUI.skin.label); wrapStyle.fontStyle = FontStyle.Bold; wrapStyle.wordWrap = true; } if (headerStyle == null) { headerStyle = new GUIStyle(GUI.skin.label); headerStyle.fontStyle = FontStyle.Bold; headerStyle.alignment = TextAnchor.UpperLeft; } GUILayout.BeginVertical("Enviro - Sky and Weather 1.9.1", boxStyle); GUILayout.Space(20); GUILayout.BeginVertical("Profile", boxStyle); GUILayout.Space(20); myTarget.profile = (EnviroProfile)EditorGUILayout.ObjectField(myTarget.profile, typeof(EnviroProfile), false); GUILayout.Space(10); if (myTarget.profile != null) { EditorGUILayout.LabelField("Profile Version:", myTarget.profile.version); } else { EditorGUILayout.LabelField("No Profile Assigned!"); } EditorGUILayout.LabelField("Prefab Version:", myTarget.prefabVersion); GUILayout.Space(10); // Runtime Settings if (GUILayout.Button("Apply all Settings")) { myTarget.enabled = false; myTarget.enabled = true; } GUILayout.EndHorizontal(); if (myTarget.profile != null) { if (myTarget.profile.modified) // Change color when modified { GUI.backgroundColor = modifiedColor; } GUILayout.BeginVertical("", boxStyle); if (myTarget.profile.modified) { GUI.backgroundColor = Color.white; } #if UNITY_5_6_OR_NEWER serializedObj.UpdateIfRequiredOrScript(); #else serializedObj.UpdateIfDirtyOrScript(); #endif myTarget.showSettings = EditorGUILayout.BeginToggleGroup(" Edit Profile", myTarget.showSettings); if (myTarget.showSettings) { GUILayout.BeginVertical("", boxStyle); GUILayout.BeginHorizontal(); if (GUILayout.Button("Save to Profile")) { myTarget.SaveProfile(); myTarget.profile.modified = false; } if (GUILayout.Button("Load from Profile")) { myTarget.ApplyProfile(myTarget.profile); myTarget.profile.modified = false; #if UNITY_5_6_OR_NEWER serializedObj.UpdateIfRequiredOrScript(); #else serializedObj.UpdateIfDirtyOrScript(); #endif } GUILayout.EndHorizontal(); GUILayout.Space(10); EditorGUILayout.LabelField("Category", headerStyle); myTarget.profile.viewMode = (EnviroProfile.settingsMode)EditorGUILayout.EnumPopup(myTarget.profile.viewMode); GUILayout.EndVertical(); switch (myTarget.profile.viewMode) { case EnviroProfile.settingsMode.Lighting: EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(lightColorGradient, true, null); EditorGUILayout.PropertyField(lightIntensityCurve, true, null); EditorGUILayout.PropertyField(shadowStrength, true, null); EditorGUILayout.PropertyField(ambientMode, true, null); EditorGUILayout.PropertyField(ambientIntensityCurve, true, null); EditorGUILayout.PropertyField(ambientSkyGradient, true, null); EditorGUILayout.PropertyField(ambientEquatorGradient, true, null); EditorGUILayout.PropertyField(ambientGroundGradient, true, null); EditorGUILayout.PropertyField(reflectionBool, true, null); EditorGUILayout.PropertyField(reflectionIntensity, true, null); EditorGUILayout.PropertyField(reflectionUpdate, true, null); ApplyChanges(); break; case EnviroProfile.settingsMode.Sky: EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(skyboxMode, true, null); EditorGUILayout.PropertyField(customSkyboxMaterial, true, null); EditorGUILayout.PropertyField(customSkyboxColor, true, null); GUILayout.Space(10); EditorGUILayout.LabelField("Scattering", headerStyle); myTarget.skySettings.waveLength = EditorGUILayout.Vector3Field("Wave Length", myTarget.skySettings.waveLength); EditorGUILayout.PropertyField(rayleigh, true, null); EditorGUILayout.PropertyField(g, true, null); EditorGUILayout.PropertyField(mie, true, null); EditorGUILayout.PropertyField(scatteringCurve, true, null); EditorGUILayout.PropertyField(scatteringColor, true, null); EditorGUILayout.PropertyField(sunMoonPos, true, null); EditorGUILayout.PropertyField(sunIntensity, true, null); EditorGUILayout.PropertyField(sunDiskScale, true, null); EditorGUILayout.PropertyField(sunDiskIntensity, true, null); EditorGUILayout.PropertyField(sunDiskColor, true, null); EditorGUILayout.PropertyField(moonPhaseMode, true, null); EditorGUILayout.PropertyField(moonTexture, true, null); EditorGUILayout.PropertyField(moonBrightness, true, null); EditorGUILayout.PropertyField(moonGlow, true, null); if (myTarget.skySettings.moonPhaseMode == EnviroSkySettings.MoonPhases.Custom) { EditorGUILayout.PropertyField(startMoonPhase, true, null); EditorGUILayout.PropertyField(currentMoonPhase, true, null); } EditorGUILayout.PropertyField(skyLuminance, true, null); EditorGUILayout.PropertyField(skyColorPower, true, null); EditorGUILayout.PropertyField(skyExposure, true, null); EditorGUILayout.PropertyField(starsCubemap, true, null); EditorGUILayout.PropertyField(starsIntensity, true, null); ApplyChanges(); break; // CLouds Category case EnviroProfile.settingsMode.Clouds: GUILayout.BeginVertical(" Layer Setup", boxStyle); GUILayout.Space(20); if (GUILayout.Button("Add Layer")) { myTarget.cloudsSettings.cloudsLayers.Add(new EnviroCloudsLayerVariables()); myTarget.showCloudLayer.Add(true); } if (GUILayout.Button("Apply Changes")) { myTarget.InitClouds(); } for (int i = 0; i < myTarget.cloudsSettings.cloudsLayers.Count; i++) { GUILayout.BeginVertical("", boxStyle); myTarget.showCloudLayer [i] = EditorGUILayout.BeginToggleGroup(myTarget.cloudsSettings.cloudsLayers [i].Name, myTarget.showCloudLayer [i]); if (myTarget.showCloudLayer [i]) { GUILayout.Space(10); myTarget.cloudsSettings.cloudsLayers [i].Name = EditorGUILayout.TextField("Layer Name", myTarget.cloudsSettings.cloudsLayers [i].Name); GUILayout.Space(10); myTarget.cloudsSettings.cloudsLayers [i].Quality = EditorGUILayout.IntSlider("Quality", myTarget.cloudsSettings.cloudsLayers [i].Quality, 5, 100); myTarget.cloudsSettings.cloudsLayers [i].segmentCount = EditorGUILayout.IntSlider("Segments", myTarget.cloudsSettings.cloudsLayers [i].segmentCount, 4, 16); myTarget.cloudsSettings.cloudsLayers [i].thickness = EditorGUILayout.Slider("Thickness", myTarget.cloudsSettings.cloudsLayers [i].thickness, 0.001f, 0.1f); myTarget.cloudsSettings.cloudsLayers [i].curved = EditorGUILayout.Toggle("Curved", myTarget.cloudsSettings.cloudsLayers [i].curved); myTarget.cloudsSettings.cloudsLayers [i].curvedIntensity = EditorGUILayout.Slider("Curved Intensity", myTarget.cloudsSettings.cloudsLayers [i].curvedIntensity, 0.001f, 0.5f); myTarget.cloudsSettings.cloudsLayers [i].Scaling = EditorGUILayout.Slider("Scaling", myTarget.cloudsSettings.cloudsLayers [i].Scaling, 0.5f, 2f); GUILayout.Space(10); myTarget.cloudsSettings.cloudsLayers [i].myCloudsTexture = (Texture)EditorGUILayout.ObjectField("Texture", myTarget.cloudsSettings.cloudsLayers [i].myCloudsTexture, typeof(Texture), true); myTarget.cloudsSettings.cloudsLayers [i].canCastShadows = EditorGUILayout.Toggle("Cast Shadows", myTarget.cloudsSettings.cloudsLayers [i].canCastShadows); GUILayout.Space(10); myTarget.cloudsSettings.cloudsLayers [i].layerAltitude = EditorGUILayout.FloatField("Layer Altitude", myTarget.cloudsSettings.cloudsLayers [i].layerAltitude); myTarget.cloudsSettings.cloudsLayers [i].LayerOffset = EditorGUILayout.FloatField("Layer Offset", myTarget.cloudsSettings.cloudsLayers [i].LayerOffset); if (GUILayout.Button("Remove")) { myTarget.cloudsSettings.cloudsLayers.Remove(myTarget.cloudsSettings.cloudsLayers [i]); if (myTarget.cloudsLayers.Count > i) { myTarget.cloudsLayers.RemoveAt(i); } myTarget.showCloudLayer.RemoveAt(i); } } EditorGUILayout.EndToggleGroup(); GUILayout.EndVertical(); } serializedObj.Update(); GUILayout.EndVertical(); GUILayout.Space(10); GUILayout.BeginVertical("Clouds Wind Animation", headerStyle); GUILayout.Space(15); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(useWindZoneDirection, true, null); EditorGUILayout.PropertyField(windTimeScale, true, null); EditorGUILayout.PropertyField(windIntensity, true, null); if (useWindZoneDirection.boolValue == false) { EditorGUILayout.PropertyField(windDirectionX, true, null); EditorGUILayout.PropertyField(windDirectionY, true, null); } GUILayout.EndVertical(); EditorGUILayout.PropertyField(worldScale, true, null); EditorGUILayout.PropertyField(fixedAltitude, true, null); EditorGUILayout.PropertyField(cloudsAltitude, true, null); EditorGUILayout.PropertyField(cloudsRenderQuality, true, null); EditorGUILayout.PropertyField(skyColor, true, null); EditorGUILayout.PropertyField(sunHighlightColor, true, null); EditorGUILayout.PropertyField(moonHighlightColor, true, null); EditorGUILayout.PropertyField(lightIntensity, true, null); ApplyChanges(); break; case EnviroProfile.settingsMode.Weather: EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(useTag, true, null); EditorGUILayout.PropertyField(wetnessAccumulationSpeed, true, null); EditorGUILayout.PropertyField(wetnessDryingSpeed, true, null); EditorGUILayout.PropertyField(snowAccumulationSpeed, true, null); EditorGUILayout.PropertyField(snowMeltingSpeed, true, null); GUILayout.Space(10); EditorGUILayout.PropertyField(cloudTransitionSpeed, true, null); EditorGUILayout.PropertyField(fogTransitionSpeed, true, null); EditorGUILayout.PropertyField(effectTransitionSpeed, true, null); EditorGUILayout.PropertyField(audioTransitionSpeed, true, null); ApplyChanges(); break; case EnviroProfile.settingsMode.Season: EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(daysInSpring, true, null); EditorGUILayout.PropertyField(daysInSummer, true, null); EditorGUILayout.PropertyField(daysInAutumn, true, null); EditorGUILayout.PropertyField(daysInWinter, true, null); ApplyChanges(); break; case EnviroProfile.settingsMode.Fog: EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(fogmode, true, null); EditorGUILayout.PropertyField(distanceFog, true, null); EditorGUILayout.PropertyField(useRadialFog, true, null); EditorGUILayout.PropertyField(startDistance, true, null); EditorGUILayout.PropertyField(distanceFogIntensity, true, null); EditorGUILayout.PropertyField(maximumFogIntensity, true, null); EditorGUILayout.PropertyField(heightFog, true, null); EditorGUILayout.PropertyField(height, true, null); EditorGUILayout.PropertyField(heightFogIntensity, true, null); EditorGUILayout.PropertyField(noiseIntensity, true, null); EditorGUILayout.PropertyField(noiseScale, true, null); myTarget.fogSettings.heightFogVelocity = EditorGUILayout.Vector2Field("Height Fog Velocity", myTarget.fogSettings.heightFogVelocity); EditorGUILayout.PropertyField(fogDitheringScale, true, null); EditorGUILayout.PropertyField(fogDitheringIntensity, true, null); ApplyChanges(); break; case EnviroProfile.settingsMode.Lightshafts: EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(resolution, true, null); EditorGUILayout.PropertyField(screenBlendMode, true, null); EditorGUILayout.PropertyField(useDepthTexture, true, null); EditorGUILayout.PropertyField(lightShaftsColorSun, true, null); EditorGUILayout.PropertyField(lightShaftsColorMoon, true, null); EditorGUILayout.PropertyField(treshholdColorSun, true, null); EditorGUILayout.PropertyField(treshholdColorMoon, true, null); EditorGUILayout.PropertyField(blurRadius, true, null); EditorGUILayout.PropertyField(shaftsIntensity, true, null); EditorGUILayout.PropertyField(maxRadius, true, null); ApplyChanges(); break; case EnviroProfile.settingsMode.Audio: myTarget.Audio.SFXHolderPrefab = (GameObject)EditorGUILayout.ObjectField("SFX Prefab:", myTarget.Audio.SFXHolderPrefab, typeof(GameObject), false); serializedObject.Update(); thunderSFX.DoLayoutList(); serializedObject.ApplyModifiedProperties(); break; case EnviroProfile.settingsMode.Satellites: GUILayout.BeginVertical(" Layer Setup", boxStyle); GUILayout.Space(20); if (GUILayout.Button("Add Satellite")) { myTarget.satelliteSettings.additionalSatellites.Add(new EnviroSatellite()); } if (GUILayout.Button("Apply Changes")) { myTarget.CheckSatellites(); } for (int i = 0; i < myTarget.satelliteSettings.additionalSatellites.Count; i++) { GUILayout.BeginVertical("", boxStyle); GUILayout.Space(10); myTarget.satelliteSettings.additionalSatellites [i].name = EditorGUILayout.TextField("Name", myTarget.satelliteSettings.additionalSatellites [i].name); GUILayout.Space(10); myTarget.satelliteSettings.additionalSatellites [i].prefab = (GameObject)EditorGUILayout.ObjectField("Prefab", myTarget.satelliteSettings.additionalSatellites [i].prefab, typeof(GameObject), false); myTarget.satelliteSettings.additionalSatellites [i].orbit = EditorGUILayout.Slider("OrbitDistance", myTarget.satelliteSettings.additionalSatellites [i].orbit, 0f, myTarget.transform.localScale.y); myTarget.satelliteSettings.additionalSatellites [i].xRot = EditorGUILayout.Slider("XRot", myTarget.satelliteSettings.additionalSatellites [i].xRot, 0f, 360f); myTarget.satelliteSettings.additionalSatellites [i].yRot = EditorGUILayout.Slider("YRot", myTarget.satelliteSettings.additionalSatellites [i].yRot, 0f, 360f); if (GUILayout.Button("Remove")) { myTarget.satelliteSettings.additionalSatellites.Remove(myTarget.satelliteSettings.additionalSatellites [i]); myTarget.CheckSatellites(); } GUILayout.EndVertical(); } serializedObj.Update(); GUILayout.EndVertical(); break; case EnviroProfile.settingsMode.Background: EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(enableBGRendering, true, null); bgRenderingLayer.intValue = EditorGUILayout.LayerField("Background Layer", bgRenderingLayer.intValue); EditorGUILayout.PropertyField(bgRenderingDistance, true, null); if (EditorGUI.EndChangeCheck()) { myTarget.ReInit(); serializedObj.ApplyModifiedProperties(); myTarget.profile.modified = true; } break; case EnviroProfile.settingsMode.Quality: EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(effectQuality, true, null); EditorGUILayout.PropertyField(updateInterval, true, null); ApplyChanges(); break; } } GUILayout.EndVertical(); EditorGUILayout.EndToggleGroup(); } GUILayout.EndVertical(); if (myTarget.profile != null) { EditorGUI.BeginChangeCheck(); // Begin Setup GUILayout.BeginVertical("", boxStyle); // Player Setup GUILayout.BeginVertical("", boxStyle); myTarget.profile.showPlayerSetup = EditorGUILayout.BeginToggleGroup("Player & Camera Setup", myTarget.profile.showPlayerSetup); if (myTarget.profile.showPlayerSetup) { GUILayout.Space(20); EditorGUILayout.PropertyField(Player, true, null); EditorGUILayout.PropertyField(Camera, true, null); GUILayout.Space(20); AssignOnRuntime.boolValue = EditorGUILayout.BeginToggleGroup("Assign On Runtime", AssignOnRuntime.boolValue); PlayerTag.stringValue = EditorGUILayout.TagField("Player Tag", PlayerTag.stringValue); CameraTag.stringValue = EditorGUILayout.TagField("Camera Tag", CameraTag.stringValue); EditorGUILayout.EndToggleGroup(); } EditorGUILayout.EndToggleGroup(); GUILayout.EndVertical(); /// Render Setup GUILayout.BeginVertical("", boxStyle); myTarget.profile.showRenderingSetup = EditorGUILayout.BeginToggleGroup("Rendering Setup", myTarget.profile.showRenderingSetup); if (myTarget.profile.showRenderingSetup) { EditorGUILayout.PropertyField(HDR, true, null); EditorGUILayout.PropertyField(setCameraClearFlags, true, null); GUILayout.Space(10); EditorGUILayout.LabelField("Layer Setup", headerStyle, null); SatTag.intValue = EditorGUILayout.LayerField("Sky Layer", SatTag.intValue); SkyTag.intValue = EditorGUILayout.LayerField("Satellite Layer", SkyTag.intValue); EditorGUILayout.PropertyField(singlePassVR, true, null); } EditorGUILayout.EndToggleGroup(); GUILayout.EndVertical(); /// Components Setup GUILayout.BeginVertical("", boxStyle); myTarget.profile.showComponentsSetup = EditorGUILayout.BeginToggleGroup("Component Setup", myTarget.profile.showComponentsSetup); if (myTarget.profile.showComponentsSetup) { EditorGUILayout.PropertyField(Sun, true, null); EditorGUILayout.PropertyField(Moon, true, null); EditorGUILayout.PropertyField(Clouds, true, null); EditorGUILayout.PropertyField(DirectLight, true, null); EditorGUILayout.PropertyField(LightningGenerator, true, null); EditorGUILayout.PropertyField(windZone, true, null); EditorGUILayout.PropertyField(GlobalReflectionProbe, true, null); EditorGUILayout.PropertyField(satellites, true, null); EditorGUILayout.PropertyField(starsRotation, true, null); } EditorGUILayout.EndToggleGroup(); GUILayout.EndVertical(); GUILayout.EndVertical(); //////////// // Begin Controls GUILayout.BeginVertical("", boxStyle); // Time Control GUILayout.BeginVertical("", boxStyle); myTarget.profile.showTimeUI = EditorGUILayout.BeginToggleGroup("Time and Location Controls", myTarget.profile.showTimeUI); if (myTarget.profile.showTimeUI) { GUILayout.Space(20); GUILayout.BeginVertical("Time", boxStyle); GUILayout.Space(20); EditorGUILayout.PropertyField(ProgressMode, true, null); GUILayout.Space(20); EditorGUILayout.PropertyField(Seconds, true, null); EditorGUILayout.PropertyField(Minutes, true, null); EditorGUILayout.PropertyField(Hours, true, null); EditorGUILayout.PropertyField(Days, true, null); EditorGUILayout.PropertyField(Years, true, null); GUILayout.Space(10); EditorGUILayout.PropertyField(DayLength, true, null); EditorGUILayout.PropertyField(NightLength, true, null); GUILayout.EndVertical(); GUILayout.BeginVertical("Season", boxStyle); GUILayout.Space(20); EditorGUILayout.PropertyField(UpdateSeason, true, null); EditorGUILayout.PropertyField(CurrentSeason, true, null); GUILayout.EndVertical(); GUILayout.BeginVertical("Location", boxStyle); GUILayout.Space(20); EditorGUILayout.PropertyField(UTC, true, null); GUILayout.Space(10); EditorGUILayout.PropertyField(Latitude, true, null); EditorGUILayout.PropertyField(Longitude, true, null); GUILayout.EndVertical(); } EditorGUILayout.EndToggleGroup(); GUILayout.EndVertical(); // Time End // Weather Control GUILayout.BeginVertical("", boxStyle); myTarget.profile.showWeatherUI = EditorGUILayout.BeginToggleGroup("Weather Controls", myTarget.profile.showWeatherUI); if (myTarget.profile.showWeatherUI) { EditorGUILayout.PropertyField(UpdateWeather, true, null); GUILayout.BeginVertical("Weather", boxStyle); GUILayout.Space(20); EditorGUILayout.PropertyField(StartWeather, true, null); GUILayout.Space(15); if (Application.isPlaying) { if (myTarget.Weather.weatherPresets.Count > 0) { GUIContent[] zonePrefabs = new GUIContent[myTarget.Weather.weatherPresets.Count]; for (int idx = 0; idx < zonePrefabs.Length; idx++) { zonePrefabs [idx] = new GUIContent(myTarget.Weather.weatherPresets [idx].Name); } int weatherID = EditorGUILayout.Popup(new GUIContent("Current Weather"), myTarget.GetActiveWeatherID(), zonePrefabs); myTarget.ChangeWeather(weatherID); } } else { EditorGUILayout.LabelField("Weather can only be changed in runtime!"); } if (GUILayout.Button("Edit current Weather Preset")) { if (myTarget.Weather.currentActiveWeatherPreset != null) { Selection.activeObject = myTarget.Weather.currentActiveWeatherPreset; } else if (myTarget.Weather.startWeatherPreset != null) { Selection.activeObject = myTarget.Weather.startWeatherPreset; } } GUILayout.EndVertical(); GUILayout.BeginVertical("Zones", boxStyle); GUILayout.Space(20); myTarget.Weather.currentActiveZone = (EnviroZone)EditorGUILayout.ObjectField("Current Zone", myTarget.Weather.currentActiveZone, typeof(EnviroZone), true); GUILayout.EndVertical(); } EditorGUILayout.EndToggleGroup(); GUILayout.EndVertical(); // Weather End // Effects Control GUILayout.BeginVertical("", boxStyle); myTarget.profile.showEffectsUI = EditorGUILayout.BeginToggleGroup("Feature Controls", myTarget.profile.showEffectsUI); if (myTarget.profile.showEffectsUI) { EditorGUILayout.PropertyField(EnableFog, true, null); EditorGUILayout.PropertyField(renderClouds, true, null); EditorGUILayout.PropertyField(EnableSunShafts, true, null); EditorGUILayout.PropertyField(EnableMoonShafts, true, null); } EditorGUILayout.EndToggleGroup(); GUILayout.EndVertical(); // Effects End // Audio Control GUILayout.BeginVertical("", boxStyle); myTarget.profile.showAudioUI = EditorGUILayout.BeginToggleGroup("Audio Controls", myTarget.profile.showAudioUI); if (myTarget.profile.showAudioUI) { GUILayout.BeginVertical("", boxStyle); EditorGUILayout.PropertyField(AmbientVolume, true, null); EditorGUILayout.PropertyField(WeatherVolume, true, null); GUILayout.EndVertical(); } EditorGUILayout.EndToggleGroup(); GUILayout.EndVertical(); // Audio End ///////////// if (EditorGUI.EndChangeCheck()) { serializedObj.ApplyModifiedProperties(); } EditorGUILayout.EndVertical(); } else { GUILayout.BeginVertical("", boxStyle); EditorGUILayout.LabelField("No profile assigned!"); if (GUILayout.Button("Create and assign new profile!")) { myTarget.profile = EnviroProfileCreation.CreateNewEnviroProfile(); myTarget.ApplyProfile(myTarget.profile); myTarget.ReInit(); } GUILayout.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 < EnviroSky.instance.Weather.weatherPresets.Count; i2++) { if (zoneWeatherPresets [i] == EnviroSky.instance.Weather.weatherPresets [i2]) { addThis = false; zoneWeather.Add(EnviroSky.instance.Weather.WeatherPrefabs [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 = EnviroSky.instance.Weather.VFXHolder.transform; wPrefab.transform.localPosition = Vector3.zero; wPrefab.transform.localRotation = Quaternion.identity; zoneWeather.Add(wP); EnviroSky.instance.Weather.WeatherPrefabs.Add(wP); EnviroSky.instance.Weather.weatherPresets.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(EnviroSky.GetEmissionRate(zoneWeather[i].effectSystems[i2])); EnviroSky.SetEmissionRate(zoneWeather[i].effectSystems[i2], 0f); } } //Set initial weather if (isDefault && EnviroSky.instance.Weather.startWeatherPreset != null) { EnviroSky.instance.SetWeatherOverwrite(EnviroSky.instance.Weather.startWeatherPreset); for (int i = 0; i < zoneWeather.Count; i++) { if (zoneWeather[i].weatherPreset == EnviroSky.instance.Weather.startWeatherPreset) { currentActiveZoneWeatherPrefab = zoneWeather[i]; lastActiveZoneWeatherPrefab = zoneWeather[i]; } } currentActiveZoneWeatherPreset = EnviroSky.instance.Weather.startWeatherPreset; lastActiveZoneWeatherPreset = EnviroSky.instance.Weather.startWeatherPreset; } else { currentActiveZoneWeatherPrefab = zoneWeather [0]; lastActiveZoneWeatherPrefab = zoneWeather [0]; currentActiveZoneWeatherPreset = zoneWeatherPresets [0]; lastActiveZoneWeatherPreset = zoneWeatherPresets [0]; } nextUpdate = EnviroSky.instance.currentTimeInHours + WeatherUpdateIntervall; }
public static void EnviroSky_AssignAndStart(EnviroSky __instance) { Status.InitializeTime(__instance); }
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; }