using System; using System.Collections.Generic; using UnityEngine; using UnityStandardAssets.ImageEffects; [Serializable] public class UniStormWeatherSystem_JS : MonoBehaviour { public int generateDateAndTime; public Color nightTintColor; public float lerp; public float starSpeedCalculator; public Renderer starSphereComponent; public Renderer heavyCloudsComponent; public Renderer moonObjectComponent; public Renderer lightClouds1Component; public Renderer lightClouds1aComponent; public Renderer heavyCloudsLayerLightComponent; public Renderer partlyCloudyClouds1Component; public Renderer partlyCloudyClouds2Component; public Renderer mostlyCloudyClouds1Component; public Renderer mostlyCloudyClouds2Component; public Renderer heavyCloudsLayer1Component; public Renderer lightClouds2Component; public Renderer lightClouds3Component; public Renderer lightClouds4Component; public Renderer lightClouds5Component; public Renderer highClouds1Component; public Renderer highClouds2Component; public Renderer mostlyCloudyCloudsComponent; public Light sunComponent; public Light moonComponent; public Light lightSourceComponent; public AudioSource soundComponent; public AudioSource rainSoundComponent; public AudioSource windSoundComponent; public AudioSource windSnowSoundComponent; public ParticleEmitter mistFogComponent; public Camera cameraObjectComponent; public bool useInstantStartingWeather; public bool moonChanger; public float sunCalculator; public int realStartTime; public float realStartTimeFloat; public int realStartTimeMinutes; public float realStartTimeMinutesFloat; public Color skyColorMorning; public Color skyColorDay; public Color skyColorEvening; public Color skyColorNight; public float mostlyCloudyFader; public float clearFader; public float colorFader; public float topStormCloudFade; public float stormyMoonLightIntensity; public bool timeOptions; public bool caledarOptions; public bool weatherOptions; public bool atmosphereOptions; public bool fogOptions; public bool lightningOptions; public bool temperatureOptions; public bool sunOptions; public bool moonOptions; public bool precipitationOptions; public bool GUIOptions; public bool soundManagerOptions; public bool colorOptions; public bool objectOptions; public bool helpOptions; public bool windOptions; public float nightLength; public int nightLengthHour; public int dayLengthHour; public int nightLengthMinute; public int dayLengthMinute; public float stormGrassWavingSpeed; public float stormGrassWavingAmount; public float stormGrassWavingStrength; public float normalGrassWavingSpeed; public float normalGrassWavingAmount; public float normalGrassWavingStrength; public float HeavyRainSunIntensity; public string timeOfDayDisplay; public GameObject sunObject; public Light moonLight; public bool terrainDetection; public int calendarType; public int numberOfDaysInMonth; public int numberOfMonthsInYear; public GameObject partlyCloudyClouds1; public GameObject partlyCloudyClouds2; public GameObject mostlyCloudyClouds1; public GameObject mostlyCloudyClouds2; public float partlyCloudyFader; public int cloudType; public bool UseRainSplashes; public bool UseRainMist; public ParticleSystem rain; public ParticleSystem rainSplashes; public ParticleSystem snow; public ParticleSystem snowMistFog; public ParticleSystem rainMist; public float sunOffSetX; public float sunOffSetY; public Vector2 sunOffSet; public float dynamicPartlyCloudyFloat1; public float dynamicPartlyCloudyFloat2; public GameObject dynamicPartlyCloudy1; public GameObject dynamicPartlyCloudy2; public Color MorningSkyboxTintContrast; public Color MiddaySkyboxTintContrast; public Color DuskSkyboxTintContrast; public Color NightSkyboxTintContrast; public int springTemp; public int summerTemp; public int fallTemp; public int winterTemp; public bool weatherShuffled; public float minHeavyRainMistIntensity; public int maxHeavyRainMistIntensity; public int moonSize; public float moonRotationY; public bool customMoonSize; public bool customMoonRotation; public Quaternion moonRotation; public Color cloudColorMorning; public Color cloudColorDay; public Color cloudColorEvening; public Color cloudColorNight; public Color stormCloudColor1; public Color stormCloudColor2; public Color stormyFogColorMorning; public Color stormyFogColorDay; public Color stormyFogColorEvening; public Color stormyFogColorNight; public Color originalFogColorMorning; public Color originalFogColorDay; public Color originalFogColorEvening; public Color originalFogColorNight; public float fader; public float fader2; public bool weatherHappened; public float moonFade; public float moonFade2; public Color moonColorFade; public int temperatureType; public int temperature_Celsius; public bool stormControl; public int forceWeatherChange; public int randomizedRainIntensity; public int currentGeneratedIntensity; public int lastWeatherType; public bool randomizedPrecipitation; public int moonShadowQuality; public bool useSunFlare; public GameObject lightFlareObject; public bool useRainStreaks; public Color sunFlareColor; public int timeToWaitMin; public int timeToWaitMax; private int timeToWaitCurrent; public float TODSoundsTimer; public bool playedSound; public bool getDelay; public int amountOfSounds; public bool useMorningSounds; public bool useDaySounds; public bool useEveningSounds; public bool useNightSounds; public Material tempMat; public Color lightningColor; public int morningSize; public int daySize; public int eveningSize; public int nightSize; public List ambientSoundsMorning; public List ambientSoundsDay; public List ambientSoundsEvening; public List ambientSoundsNight; public List foldOutList; public bool shadowsDuringDay; public float dayShadowIntensity; public int dayShadowType; public bool shadowsDuringNight; public float nightShadowIntensity; public int nightShadowType; public bool shadowsLightning; public float lightningShadowIntensity; public int lightningShadowType; public int fogMode; public string version; public int materialIndex; public Vector2 uvAnimationRateA; public string CloudA; public Vector2 uvAnimationRateB; public string CloudB; public Vector2 uvAnimationRateC; public string CloudC; public Vector2 uvAnimationRateHeavyA; public Vector2 uvAnimationRateHeavyB; public Vector2 uvAnimationRateHeavyC; public Vector2 uvOffsetA; public Vector2 uvOffsetB; public Vector2 uvOffsetC; public Vector2 uvOffsetHeavyA; public Vector2 uvOffsetHeavyB; public Vector2 uvOffsetHeavyC; public bool scale; public float scaleX; public float scaleY; public int cloudDensity; public AudioClip customRainSound; public AudioClip customRainWindSound; public AudioClip customSnowWindSound; public bool useCustomPrecipitationSounds; public bool useUnityFog; public string weatherString; public int minuteCounter; public int hourCounter; public int dayCounter; public int monthCounter; public int yearCounter; public int temperature; public float dayLength; public float cloudSpeed; public float heavyCloudSpeed; public float starSpeed; public float starRotationSpeed; public bool timeStopped; public bool staticWeather; public bool realWordSunPosistion; public bool timeScrollBar; public bool dynamicSnowEnabled; public bool weatherCommandPromptUseable; public bool timeScrollBarUseable; public float startTime; public float moonPhaseChangeTime; public int weatherForecaster; public int weatherForecasterStart; public string stringToEdit; public float sunIntensity; public float maxSunIntensity; public float moonLightIntensity; public float sunAngle; public Color TwilightAmbientLight; public Color MorningAmbientLight; public Color MiddayAmbientLight; public Color DuskAmbientLight; public Color NightAmbientLight; private Color backgroundNightColor; private Color backgroundDuskColor; private Color backgroundMorningColor; private Color backgroundMiddayColor; public Color SunMorning; public Color SunDay; public Color SunDusk; public Color SunNight; public Color stormyFogColorDay_GF; public Color stormyFogColorDuskDawn_GF; public Color stormyFogColorNight_GF; public Color fogMorningColor; public Color fogDayColor; public Color fogDuskColor; public Color fogNightColor; public float fogDensity; public Material SkyBoxMaterial; public Color MorningGradientContrastLight; public Color DayGradientContrastLight; public Color DuskGradientContrastLight; public Color NightGradientContrastLight; public Color MorningAtmosphericLight; public Color MiddayAtmosphericLight; public Color DuskAtmosphericLight; public GameObject starSphere; public GameObject gradientSphere; public Color starBrightness; public GameObject moonObject; public Color moonColor; public int moonPhaseCalculator; public float moonFadeOutTime; public float moonFadeInTime; public Color moonFadeColor; public Material moonPhase1; public Material moonPhase2; public Material moonPhase3; public Material moonPhase4; public Material moonPhase5; public Material moonPhase6; public Material moonPhase7; public Material moonPhase8; public GameObject lightClouds1; public GameObject lightClouds1a; public GameObject lightClouds2; public GameObject lightClouds3; public GameObject lightClouds4; public GameObject lightClouds5; public GameObject highClouds1; public GameObject highClouds2; public GameObject mostlyCloudyClouds; public GameObject heavyClouds; public GameObject heavyCloudsLayer1; public GameObject heavyCloudsLayerLight; public float maxLightRainIntensity; public float maxLightRainMistCloudsIntensity; public float maxStormRainIntensity; public float maxStormMistCloudsIntensity; public float maxLightSnowIntensity; public float maxLightSnowDustIntensity; public float maxSnowStormIntensity; public float maxHeavySnowDustIntensity; public ParticleSystem butterflies; public GameObject mistFog; public ParticleSystem windyLeaves; public GameObject windZone; public GameObject snowObject; public Light sun; public Light moon; public GameObject rainSound; public GameObject windSound; public GameObject windSnowSound; public GameObject cameraObject; public int startTimeNumber; public bool hour1; public bool hour2; public bool hour3; public bool hour4; public bool hour5; public bool hour6; public bool hour7; public bool hour8; public bool hour9; public bool hour10; public bool hour11; public bool hour12; public bool hour13; public bool hour14; public bool hour15; public bool hour16; public bool hour17; public bool hour18; public bool hour19; public bool hour20; public bool hour21; public bool hour22; public bool hour23; public bool hour0; private float random; private float random2; private int sunRotate; private float fadeHorizonController; private float fadeHorizon; private float stormClouds; private float fade; private float fade2; private float butterfliesFade; private float windyLeavesFade; private float fadeStormClouds; private float fadeStars; private float time; private float sunShaftFade; private float fadeCloudsNight; private float windControl; private float windControlUp; private float clearClouds; private float windSnowSoundHandler; private float dynamicSnowFade; private bool overrideFog; private float stormCounter; private int forceStorm; private int changeWeather; private string foggy; private string lightRain_lightSnow; private string rainStorm_snowStorm; private string partlyCloudy1; private string partlyCloudy2; private string partlyCloudy3; private string clear1; private string clear2; private string cloudy; private string mostlyCloudy; private string heavyRain; private string fallLeaves; private string butterfliesSummer; private bool commandPromptActive; public float minRainIntensity; public float minFogIntensity; public float minSnowIntensity; public float minSnowFogIntensity; private float calculate2; private float lockAxisZ; private float lockAxisY; public float Hour; public float minuteCounterCalculator; public float yearCounterCalculator; private float cloudSpeedY; private SunShafts sunShaftScript; public int weatherOdds; public int weatherChanceSpring; public bool isSpring; public int weatherChanceSummer; public bool isSummer; public int weatherChanceFall; public bool isFall; public int weatherChanceWinter; public bool isWinter; public int weatherUpdate; public bool weatherUpdateActive; public bool temperatureFluctuation; public bool temperatureGenerator; public int minSpringTemp; public int maxSpringTemp; public int minSummerTemp; public int maxSummerTemp; public int minFallTemp; public int maxFallTemp; public int minWinterTemp; public int maxWinterTemp; public int startingSpringTemp; public int startingSummerTemp; public int startingFallTemp; public int startingWinterTemp; public bool loadSpringTemp; public bool loadSummerTemp; public bool loadFallTemp; public bool loadWinterTemp; public bool morningTime_eveningTime; public bool dayTime; public bool nightTime; public Color waterBaseNightColor; public Color waterBaseMorningColor; public Color waterBaseDuskColor; public Color waterBaseDayColor; public Color waterLightNightColor; public Color waterLightMorningColor; public Color waterLightDuskColor; public Color waterLightDayColor; public Light lightSource; public float lightningFlashLength; public int lightningMinChance; public int lightningMaxChance; public float minIntensity; public float maxIntensity; public float lightningIntensity; public float lightningOdds; public float timer; public float onTimer; public bool lightingGenerated; public bool fadeLightning; public GameObject lightningBolt1; public AudioClip thunderSound1; public AudioClip thunderSound2; public AudioClip thunderSound3; public AudioClip thunderSound4; public AudioClip thunderSound5; public int lightningNumber; public Transform lightningSpawn; public int[] intArray; public int stormyFogDistance; public int stormyFogDistanceStart; public int fogStartDistance; public int fogEndDistance; public bool useUnity5Sun; public float sunSize; public Color skyTintColor; public Color groundColor; public float atmosphereThickness; public float exposure; public float minuteCounterNew; public UniStormWeatherSystem_JS() { generateDateAndTime = 1; timeOptions = true; caledarOptions = true; weatherOptions = true; atmosphereOptions = true; fogOptions = true; lightningOptions = true; temperatureOptions = true; sunOptions = true; moonOptions = true; precipitationOptions = true; GUIOptions = true; soundManagerOptions = true; colorOptions = true; objectOptions = true; helpOptions = true; windOptions = true; numberOfDaysInMonth = 31; numberOfMonthsInYear = 12; cloudType = 1; UseRainSplashes = true; UseRainMist = true; sunOffSet = new Vector2(0f, 0f); maxHeavyRainMistIntensity = 20; moonSize = 4; moonRotationY = 4f; moonRotation = Quaternion.identity; temperatureType = 1; temperature_Celsius = 1; stormControl = true; moonShadowQuality = 2; useRainStreaks = true; timeToWaitCurrent = 3; dayShadowType = 1; nightShadowType = 1; lightningShadowType = 1; fogMode = 1; uvAnimationRateA = new Vector2(1f, 0f); CloudA = "_MainTex1"; uvAnimationRateB = new Vector2(1f, 0f); CloudB = "_MainTex2"; uvAnimationRateC = new Vector2(1f, 0f); CloudC = "_MainTex3"; uvAnimationRateHeavyA = new Vector2(1f, 0f); uvAnimationRateHeavyB = new Vector2(1f, 0f); uvAnimationRateHeavyC = new Vector2(1f, 0f); uvOffsetA = Vector2.zero; uvOffsetB = Vector2.zero; uvOffsetC = Vector2.zero; uvOffsetHeavyA = Vector2.zero; uvOffsetHeavyB = Vector2.zero; uvOffsetHeavyC = Vector2.zero; realWordSunPosistion = true; dynamicSnowEnabled = true; stringToEdit = "0"; maxLightRainIntensity = 400f; maxLightRainMistCloudsIntensity = 4f; maxStormRainIntensity = 1000f; maxStormMistCloudsIntensity = 15f; maxLightSnowIntensity = 400f; maxLightSnowDustIntensity = 4f; maxSnowStormIntensity = 1000f; maxHeavySnowDustIntensity = 15f; foggy = "01"; lightRain_lightSnow = "02"; rainStorm_snowStorm = "03"; partlyCloudy1 = "04"; partlyCloudy2 = "05"; partlyCloudy3 = "06"; clear1 = "07"; clear2 = "08"; cloudy = "09"; mostlyCloudy = "001"; heavyRain = "002"; fallLeaves = "003"; butterfliesSummer = "004"; lightningMinChance = 5; lightningMaxChance = 10; intArray = new int[0]; useUnity5Sun = true; sunSize = 0.2f; } public virtual void Awake() { if (useCustomPrecipitationSounds) { ((AudioSource)rainSound.GetComponent(typeof(AudioSource))).clip = customRainSound; ((AudioSource)rainSound.GetComponent(typeof(AudioSource))).enabled = false; ((AudioSource)windSound.GetComponent(typeof(AudioSource))).clip = customRainWindSound; ((AudioSource)windSound.GetComponent(typeof(AudioSource))).enabled = false; ((AudioSource)windSnowSound.GetComponent(typeof(AudioSource))).clip = customSnowWindSound; ((AudioSource)windSnowSound.GetComponent(typeof(AudioSource))).enabled = false; } } public virtual void Start() { if (useCustomPrecipitationSounds) { ((AudioSource)rainSound.GetComponent(typeof(AudioSource))).enabled = true; ((AudioSource)windSound.GetComponent(typeof(AudioSource))).enabled = true; ((AudioSource)windSnowSound.GetComponent(typeof(AudioSource))).enabled = true; } GetAllComponents(); RenderSettings.fog = true; RenderSettings.skybox = SkyBoxMaterial; SkyBoxMaterial.SetColor("_SkyTint", skyTintColor); SkyBoxMaterial.SetColor("_GroundColor", groundColor); SkyBoxMaterial.SetFloat("_AtmosphereThickness", atmosphereThickness); SkyBoxMaterial.SetFloat("_Exposure", exposure); SkyBoxMaterial.SetFloat("_SunSize", 0f); SkyBoxMaterial.SetColor("_NightSkyTint", nightTintColor); useSunFlare = true; realStartTimeMinutesFloat = realStartTimeMinutes; realStartTimeFloat = realStartTime; startTime = realStartTimeFloat / 24f + realStartTimeMinutesFloat / 1440f; if (Terrain.activeTerrain == null) { terrainDetection = false; } if (Terrain.activeTerrain != null) { terrainDetection = true; } if (terrainDetection) { if (Terrain.activeTerrain.terrainData.wavingGrassSpeed <= normalGrassWavingSpeed || !(Terrain.activeTerrain.terrainData.wavingGrassSpeed < normalGrassWavingSpeed)) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = normalGrassWavingSpeed; } if (Terrain.activeTerrain.terrainData.wavingGrassAmount <= normalGrassWavingStrength || !(Terrain.activeTerrain.terrainData.wavingGrassAmount < normalGrassWavingStrength)) { Terrain.activeTerrain.terrainData.wavingGrassAmount = normalGrassWavingStrength; } if (Terrain.activeTerrain.terrainData.wavingGrassStrength <= normalGrassWavingAmount || !(Terrain.activeTerrain.terrainData.wavingGrassStrength < normalGrassWavingAmount)) { Terrain.activeTerrain.terrainData.wavingGrassStrength = normalGrassWavingAmount; } } if ((cloudType == 1 && weatherForecaster == 4) || (cloudType == 1 && weatherForecaster == 5) || (cloudType == 1 && weatherForecaster == 6)) { partlyCloudyFader = 1f; colorFader = 1f; mostlyCloudyFader = 0f; } if (cloudType == 1 && weatherForecaster == 7) { partlyCloudyFader = 0f; colorFader = 1f; mostlyCloudyFader = 0f; } if (cloudType == 1 && weatherForecaster == 8) { partlyCloudyFader = 0f; colorFader = 0f; mostlyCloudyFader = 0f; } if (cloudType == 1 && weatherForecaster == 11) { partlyCloudyFader = 1f; colorFader = 1f; mostlyCloudyFader = 1f; } weatherUpdate = 0; timeScrollBar = false; fader2 = 1f; LogErrorCheck(); if (UseRainSplashes) { rainSplashes.gameObject.SetActive(true); } if (!UseRainSplashes) { rainSplashes.gameObject.SetActive(false); } originalFogColorMorning = fogMorningColor; originalFogColorDay = fogDayColor; originalFogColorEvening = fogDuskColor; originalFogColorNight = fogNightColor; if (customMoonSize) { moonObject.transform.localScale = new Vector3(moonSize, moonSize, moonSize); } if (customMoonRotation) { moonObject.transform.localEulerAngles = new Vector3(0f, moonRotationY, 0f); } if (useUnityFog) { RenderSettings.fog = true; } if (fogMode == 1) { RenderSettings.fogMode = FogMode.Linear; } if (fogMode == 2) { RenderSettings.fogMode = FogMode.Exponential; } if (fogMode == 3) { RenderSettings.fogMode = FogMode.ExponentialSquared; } sunIntensity = maxSunIntensity; lightSource.color = lightningColor; if (cloudType == 2) { heavyCloudsLayerLight.SetActive(false); heavyCloudsLayer1.SetActive(true); lightClouds1.SetActive(false); lightClouds1a.SetActive(false); lightClouds2.SetActive(true); lightClouds3.SetActive(true); lightClouds4.SetActive(true); lightClouds5.SetActive(true); highClouds1.SetActive(true); highClouds2.SetActive(true); mostlyCloudyClouds.SetActive(true); } if (cloudType == 1) { lightClouds1.SetActive(true); heavyCloudsLayerLight.SetActive(true); heavyCloudsLayer1.SetActive(false); lightClouds2.SetActive(false); lightClouds3.SetActive(false); lightClouds4.SetActive(false); lightClouds5.SetActive(false); highClouds1.SetActive(false); highClouds2.SetActive(false); mostlyCloudyClouds.SetActive(false); partlyCloudyClouds1.SetActive(true); if (cloudDensity == 1) { lightClouds1a.SetActive(false); partlyCloudyClouds2.SetActive(false); } if (cloudDensity == 2) { lightClouds1a.SetActive(true); partlyCloudyClouds2.SetActive(true); } } uvAnimationRateA = new Vector2(0.001f, 0f); uvAnimationRateB = new Vector2(0.001f, 0.001f); uvAnimationRateC = new Vector2(0.0001f, 0f); uvAnimationRateHeavyA = new Vector2(0.005f, 0.001f); uvAnimationRateHeavyB = new Vector2(0.004f, 0.0035f); uvAnimationRateHeavyC = new Vector2(0.0001f, 0f); if (useSunFlare) { sunObject = GameObject.Find("SunGlow"); sunObject.transform.localScale = new Vector3(sunSize, sunSize, sunSize); sunObject.SetActive(true); } if (useRainStreaks) { mistFog.SetActive(true); } if (!useRainStreaks) { mistFog.SetActive(false); } if (RenderSettings.fogMode == FogMode.Linear) { RenderSettings.fogStartDistance = fogStartDistance; RenderSettings.fogEndDistance = fogEndDistance; } moonLight = (Light)moon.GetComponent(typeof(Light)); moonLight.intensity = moonLightIntensity; if (useInstantStartingWeather) { TemperatureGeneration(); InstantWeather(); } } public virtual void GetAllComponents() { heavyCloudsLayer1Component = (Renderer)heavyCloudsLayer1.GetComponent(typeof(Renderer)); lightClouds2Component = (Renderer)lightClouds2.GetComponent(typeof(Renderer)); lightClouds3Component = (Renderer)lightClouds3.GetComponent(typeof(Renderer)); lightClouds4Component = (Renderer)lightClouds4.GetComponent(typeof(Renderer)); lightClouds5Component = (Renderer)lightClouds5.GetComponent(typeof(Renderer)); highClouds1Component = (Renderer)highClouds1.GetComponent(typeof(Renderer)); highClouds2Component = (Renderer)highClouds2.GetComponent(typeof(Renderer)); mostlyCloudyCloudsComponent = (Renderer)mostlyCloudyClouds.GetComponent(typeof(Renderer)); heavyCloudsComponent = (Renderer)heavyClouds.GetComponent(typeof(Renderer)); starSphereComponent = (Renderer)starSphere.GetComponent(typeof(Renderer)); lightClouds1Component = (Renderer)lightClouds1.GetComponent(typeof(Renderer)); lightClouds1aComponent = (Renderer)lightClouds1a.GetComponent(typeof(Renderer)); heavyCloudsLayerLightComponent = (Renderer)heavyCloudsLayerLight.GetComponent(typeof(Renderer)); partlyCloudyClouds1Component = (Renderer)partlyCloudyClouds1.GetComponent(typeof(Renderer)); partlyCloudyClouds2Component = (Renderer)partlyCloudyClouds2.GetComponent(typeof(Renderer)); mostlyCloudyClouds1Component = (Renderer)mostlyCloudyClouds1.GetComponent(typeof(Renderer)); mostlyCloudyClouds2Component = (Renderer)mostlyCloudyClouds2.GetComponent(typeof(Renderer)); moonObjectComponent = (Renderer)moonObject.GetComponent(typeof(Renderer)); sunComponent = (Light)sun.GetComponent(typeof(Light)); lightSourceComponent = (Light)lightSource.GetComponent(typeof(Light)); moonComponent = (Light)moon.GetComponent(typeof(Light)); soundComponent = (AudioSource)GetComponent(typeof(AudioSource)); rainSoundComponent = (AudioSource)rainSound.GetComponent(typeof(AudioSource)); windSoundComponent = (AudioSource)windSound.GetComponent(typeof(AudioSource)); windSnowSoundComponent = (AudioSource)windSnowSound.GetComponent(typeof(AudioSource)); mistFogComponent = (ParticleEmitter)mistFog.GetComponent(typeof(ParticleEmitter)); cameraObjectComponent = (Camera)cameraObject.GetComponent(typeof(Camera)); sunShaftScript = (SunShafts)cameraObjectComponent.GetComponent(typeof(SunShafts)); if (sunShaftScript == null) { Debug.LogError("Please apply a C# Sun Shaft Script to your camera GameObject."); } } public virtual void Update() { if (weatherForecaster == 2 && useRainStreaks && !(minFogIntensity > 0f)) { mistFog.gameObject.SetActive(false); } if (((weatherForecaster == 3 && useRainStreaks) || (weatherForecaster == 12 && useRainStreaks)) && !(minFogIntensity < 1f)) { mistFog.gameObject.SetActive(true); } if (weatherForecaster == 2 && UseRainMist && !(minHeavyRainMistIntensity > 0f)) { rainMist.gameObject.SetActive(false); } if (((weatherForecaster == 3 && UseRainMist) || (weatherForecaster == 12 && UseRainMist)) && !(minHeavyRainMistIntensity < 1f)) { rainMist.gameObject.SetActive(true); } if (minuteCounter <= 5) { weatherShuffled = false; } if (minuteCounter > 58 && !weatherShuffled) { weatherShuffled = true; if (weatherUpdate == 1 && isSpring) { if (weatherChanceSpring == 80) { weatherOdds = UnityEngine.Random.Range(80, 100); } if (weatherChanceSpring == 60) { weatherOdds = UnityEngine.Random.Range(60, 100); } if (weatherChanceSpring == 40) { weatherOdds = UnityEngine.Random.Range(40, 100); } if (weatherChanceSpring == 20) { weatherOdds = UnityEngine.Random.Range(20, 100); } } if (weatherUpdate == 1 && isSummer) { if (weatherChanceSummer == 80) { weatherOdds = UnityEngine.Random.Range(80, 100); } if (weatherChanceSummer == 60) { weatherOdds = UnityEngine.Random.Range(60, 100); } if (weatherChanceSummer == 40) { weatherOdds = UnityEngine.Random.Range(40, 100); } if (weatherChanceSummer == 20) { weatherOdds = UnityEngine.Random.Range(20, 100); } } if (weatherUpdate == 1 && isFall) { if (weatherChanceFall == 80) { weatherOdds = UnityEngine.Random.Range(80, 100); } if (weatherChanceFall == 60) { weatherOdds = UnityEngine.Random.Range(60, 100); } if (weatherChanceFall == 40) { weatherOdds = UnityEngine.Random.Range(40, 100); } if (weatherChanceFall == 20) { weatherOdds = UnityEngine.Random.Range(20, 100); } } if (weatherUpdate == 1 && isWinter) { if (weatherChanceWinter == 80) { weatherOdds = UnityEngine.Random.Range(80, 100); } if (weatherChanceWinter == 60) { weatherOdds = UnityEngine.Random.Range(60, 100); } if (weatherChanceWinter == 40) { weatherOdds = UnityEngine.Random.Range(40, 100); } if (weatherChanceWinter == 20) { weatherOdds = UnityEngine.Random.Range(20, 100); } } } hourCounter = (int)Hour; stormCounter += Time.deltaTime * 0.5f; minuteCounterCalculator = Hour * 60f; minuteCounter = (int)minuteCounterCalculator; minuteCounterNew = minuteCounter; float num = cloudSpeed * 0.001f; float num2 = heavyCloudSpeed * 0.001f; starSpeedCalculator += starSpeed * 0.1f; cloudSpeedY = 0.003f; float num3 = starSpeed * 0.001f; float num4 = Time.time * num; float num5 = Time.time * num2; float y = Time.time * cloudSpeedY; float y2 = Time.time * num; float x = Time.time * num3; float y3 = Time.time * starRotationSpeed * 0.005f; if (cloudType == 2) { heavyCloudsLayer1Component.sharedMaterial.mainTextureOffset = new Vector2(num5, 0f); lightClouds2Component.sharedMaterial.mainTextureOffset = new Vector2(num4, num4); lightClouds3Component.sharedMaterial.mainTextureOffset = new Vector2(0f, num4); lightClouds4Component.sharedMaterial.mainTextureOffset = new Vector2(num4, num4); lightClouds5Component.sharedMaterial.mainTextureOffset = new Vector2(0f, num4); highClouds1Component.sharedMaterial.mainTextureOffset = new Vector2(0f, y2); highClouds2Component.sharedMaterial.mainTextureOffset = new Vector2(0f, y2); mostlyCloudyCloudsComponent.sharedMaterial.mainTextureOffset = new Vector2(0f, y); } starSphereComponent.sharedMaterial.mainTextureOffset = new Vector2(x, 0.02f); heavyCloudsComponent.sharedMaterial.mainTextureOffset = new Vector2(num5, num5); starSphere.transform.eulerAngles = new Vector3(270f, y3, 0f); if (shadowsDuringDay) { if (dayShadowType == 1) { sunComponent.shadows = LightShadows.Hard; } if (dayShadowType == 2) { sunComponent.shadows = LightShadows.Soft; } sunComponent.shadowStrength = dayShadowIntensity; } if (!shadowsDuringDay) { sunComponent.shadows = LightShadows.None; } if (shadowsDuringNight) { if (nightShadowType == 1) { moonComponent.shadows = LightShadows.Hard; } if (nightShadowType == 2) { moonComponent.shadows = LightShadows.Soft; } moonComponent.shadowStrength = nightShadowIntensity; } if (!shadowsDuringNight) { moonComponent.shadows = LightShadows.None; } if (shadowsLightning) { if (lightningShadowType == 1) { lightSourceComponent.shadows = LightShadows.Hard; } if (lightningShadowType == 2) { lightSourceComponent.shadows = LightShadows.Soft; } lightSourceComponent.shadowStrength = lightningShadowIntensity; } if (!shadowsLightning) { lightSourceComponent.shadows = LightShadows.None; } if (monthCounter >= 2 && monthCounter <= 4) { isSpring = true; isSummer = false; isFall = false; isWinter = false; WeatherForecaster(); } if (monthCounter >= 5 && monthCounter <= 7) { isSummer = true; isSpring = false; isFall = false; isWinter = false; WeatherForecaster(); } if (monthCounter >= 8 && monthCounter <= 10) { isSummer = false; isSpring = false; isFall = true; isWinter = false; WeatherForecaster(); } if (monthCounter == 11 || monthCounter == 12 || monthCounter == 1) { isSummer = false; isSpring = false; isFall = false; isWinter = true; WeatherForecaster(); } if (weatherCommandPromptUseable && Input.GetKeyDown(KeyCode.U)) { commandPromptActive = !commandPromptActive; } if (timeScrollBarUseable && Input.GetKeyDown(KeyCode.U)) { timeScrollBar = !timeScrollBar; } if (!weatherCommandPromptUseable) { commandPromptActive = false; } TemperatureGeneration(); if (monthCounter == -1) { monthCounter = 11; } if (!(Hour < 20f)) { moonComponent.enabled = true; } if (!(Hour < 0f) && !(Hour >= 4f)) { moonComponent.enabled = true; } if (!(Hour <= 4f) && !(Hour >= 20f)) { moonComponent.enabled = false; } MoonPhaseCalculator(); sun.transform.eulerAngles = new Vector3(startTime * 360f - 90f, sunAngle, 180f); if (hourCounter == 1 && !hour1) { temperature -= UnityEngine.Random.Range(1, 3); hour1 = true; } if (hourCounter == 2 && !hour2) { temperature -= UnityEngine.Random.Range(1, 3); hour2 = true; } if (hourCounter == 3 && !hour3) { temperature -= UnityEngine.Random.Range(1, 3); hour3 = true; } if (hourCounter == 4 && !hour4) { temperature -= UnityEngine.Random.Range(1, 3); hour4 = true; } if (hourCounter == 5 && !hour5) { temperature -= UnityEngine.Random.Range(1, 3); hour5 = true; } if (hourCounter == 6 && !hour6) { temperature += UnityEngine.Random.Range(1, 3); hour6 = true; } if (hourCounter == 7 && !hour7) { temperature += UnityEngine.Random.Range(1, 3); hour7 = true; } if (hourCounter == 8 && !hour8) { temperature += UnityEngine.Random.Range(1, 3); hour8 = true; } if (hourCounter == 9 && !hour9) { temperature += UnityEngine.Random.Range(1, 3); hour9 = true; } if (hourCounter == 10 && !hour10) { temperature += UnityEngine.Random.Range(1, 3); hour10 = true; } if (hourCounter == 11 && !hour11) { temperature += UnityEngine.Random.Range(1, 3); hour11 = true; } if (hourCounter == 12 && !hour12) { temperature += UnityEngine.Random.Range(1, 3); hour12 = true; } if (hourCounter == 13 && !hour13) { temperature += UnityEngine.Random.Range(1, 3); hour13 = true; } if (hourCounter == 14 && !hour14) { temperature += UnityEngine.Random.Range(1, 3); hour14 = true; } if (hourCounter == 15 && !hour15) { temperature += UnityEngine.Random.Range(1, 3); hour15 = true; } if (hourCounter == 16 && !hour16) { temperature += UnityEngine.Random.Range(1, 3); hour16 = true; } if (hourCounter == 17 && !hour17) { temperature -= UnityEngine.Random.Range(1, 3); hour17 = true; } if (hourCounter == 18 && !hour18) { temperature -= UnityEngine.Random.Range(1, 3); hour18 = true; } if (hourCounter == 19 && !hour19) { temperature -= UnityEngine.Random.Range(1, 3); hour19 = true; } if (hourCounter == 20 && !hour20) { temperature -= UnityEngine.Random.Range(1, 3); hour20 = true; } if (hourCounter == 21 && !hour21) { temperature -= UnityEngine.Random.Range(1, 3); hour21 = true; } if (hourCounter == 22 && !hour22) { temperature -= UnityEngine.Random.Range(1, 3); hour22 = true; } if (hourCounter == 23 && !hour23) { temperature -= UnityEngine.Random.Range(1, 3); hour23 = true; } if (hourCounter == 24 && !hour0) { temperature -= UnityEngine.Random.Range(1, 3); hour0 = true; } if (!(Hour < 12f) && !moonChanger) { moonPhaseCalculator++; moonChanger = true; } if (!(Hour > 1f)) { moonChanger = false; } if (minuteCounter >= 60) { minuteCounter = (int)(minuteCounterCalculator % 60f); } if (minuteCounter == 59) { weatherUpdate++; } if (minuteCounter == 1) { weatherUpdate = 0; } if (calendarType == 1) { if ((dayCounter >= 32 && monthCounter == 1) || (dayCounter >= 32 && monthCounter == 3) || (dayCounter >= 32 && monthCounter == 5) || (dayCounter >= 32 && monthCounter == 7) || (dayCounter >= 32 && monthCounter == 8) || (dayCounter >= 32 && monthCounter == 10) || (dayCounter >= 32 && monthCounter == 12)) { dayCounter %= 32; dayCounter++; monthCounter++; } if ((dayCounter == 31 && monthCounter == 4) || (dayCounter == 31 && monthCounter == 6) || (dayCounter == 31 && monthCounter == 9) || (dayCounter == 31 && monthCounter == 11)) { dayCounter %= 31; dayCounter++; monthCounter++; } if ((dayCounter >= 30 && monthCounter == 2 && yearCounter % 4 == 0 && yearCounter % 100 != 0) || yearCounter % 400 == 0) { dayCounter %= 30; dayCounter++; monthCounter++; } else if (dayCounter >= 29 && monthCounter == 2 && yearCounter % 4 != 0) { dayCounter %= 29; dayCounter++; monthCounter++; } if (monthCounter > 12) { monthCounter %= 13; yearCounter++; monthCounter++; } } if (calendarType == 2) { if (dayCounter > numberOfDaysInMonth) { dayCounter = dayCounter % numberOfDaysInMonth - 1; dayCounter++; monthCounter++; } if (monthCounter > numberOfMonthsInYear) { monthCounter = monthCounter % numberOfMonthsInYear - 1; yearCounter++; monthCounter++; } } if (!staticWeather) { if (((weatherOdds == 20 && weatherChanceSpring == 20) || (weatherOdds == 20 && weatherChanceSummer == 20) || (weatherOdds == 20 && weatherChanceFall == 20) || (weatherOdds == 20 && weatherChanceWinter == 20)) && !(stormCounter < 13f)) { weatherForecaster = UnityEngine.Random.Range(1, 13); weatherOdds = 1; stormCounter = UnityEngine.Random.Range(0, 7); } if (((weatherOdds == 40 && weatherChanceSpring == 40 && weatherOdds == 40 && weatherChanceSummer == 40) || (weatherOdds == 40 && weatherChanceFall == 40) || (weatherOdds == 40 && weatherChanceWinter == 40)) && !(stormCounter < 13f)) { weatherForecaster = UnityEngine.Random.Range(1, 13); weatherOdds = 1; stormCounter = UnityEngine.Random.Range(0, 7); } if (((weatherOdds == 60 && weatherChanceSpring == 60 && weatherOdds == 60 && weatherChanceSummer == 60) || (weatherOdds == 60 && weatherChanceFall == 60) || (weatherOdds == 60 && weatherChanceWinter == 60)) && !(stormCounter < 13f)) { weatherForecaster = UnityEngine.Random.Range(1, 13); weatherOdds = 1; stormCounter = UnityEngine.Random.Range(0, 7); } if (((weatherOdds == 80 && weatherChanceSpring == 80 && weatherOdds == 80 && weatherChanceSummer == 80) || (weatherOdds == 80 && weatherChanceFall == 80) || (weatherOdds == 80 && weatherChanceWinter == 80)) && !(stormCounter < 13f)) { weatherForecaster = UnityEngine.Random.Range(1, 13); weatherOdds = 1; stormCounter = UnityEngine.Random.Range(0, 7); } } Hour = startTime * 24f; if (!timeStopped) { if (!(Hour < (float)dayLengthHour) && !(Hour >= (float)nightLengthHour)) { startTime += Time.deltaTime / dayLength / 60f; } if (Hour >= (float)nightLengthHour || !(Hour >= (float)dayLengthHour)) { startTime += Time.deltaTime / nightLength / 60f; } } sun.intensity = (calculate2 - 0.1f) * sunIntensity; if (!(sunIntensity > 0f)) { sunIntensity = 0f; sun.enabled = false; } if (!(sunIntensity < 0.01f)) { sun.enabled = true; } if (!(sunIntensity < maxSunIntensity)) { sunIntensity = maxSunIntensity; lightSourceComponent.enabled = false; } sunCalculator = Hour / 24f; if (!(sunCalculator >= 0.5f)) { calculate2 = sunCalculator; } if (!(sunCalculator <= 0.5f)) { calculate2 = 1f - sunCalculator; } if (!(startTime < 1f)) { startTime = 0f; CalculateDays(); } if (forceStorm >= 7 && !staticWeather) { weatherForecaster = UnityEngine.Random.Range(2, 3); forceStorm = 0; } if (changeWeather >= forceWeatherChange && stormControl && !staticWeather) { weatherForecaster = UnityEngine.Random.Range(4, 11); changeWeather = 0; } if (weatherForecaster == 1 || weatherForecaster == 2 || weatherForecaster == 3 || weatherForecaster == 12 || weatherForecaster == 9) { fader += 0.002f; fader2 -= 0.01f; if (!(fader2 > 0f)) { fader2 = 0f; } if (!(fader < 1f)) { fader = 1f; weatherHappened = true; } fogMorningColor = Color.Lerp(originalFogColorMorning, stormyFogColorMorning, fader); fogDayColor = Color.Lerp(originalFogColorDay, stormyFogColorDay, fader); fogDuskColor = Color.Lerp(originalFogColorEvening, stormyFogColorEvening, fader); fogNightColor = Color.Lerp(originalFogColorNight, stormyFogColorNight, fader); } if (weatherForecaster == 4 || weatherForecaster == 5 || weatherForecaster == 6 || weatherForecaster == 7 || weatherForecaster == 8) { fader2 += 0.0005f; fader -= 0.0025f; fogMorningColor = Color.Lerp(stormyFogColorMorning, originalFogColorMorning, fader2); fogDayColor = Color.Lerp(stormyFogColorDay, originalFogColorDay, fader2); fogDuskColor = Color.Lerp(stormyFogColorEvening, originalFogColorEvening, fader2); fogNightColor = Color.Lerp(stormyFogColorNight, originalFogColorNight, fader2); if (!(fader2 < 1f)) { weatherHappened = false; fader2 = 1f; } if (!(fader > 0f)) { fader = 0f; } } TimeOfDayCalculator(); DynamicCloudFormations(); DynamicTimeOfDaySounds(); } public virtual void TimeOfDayCalculator() { if (!(Hour <= 2f) && !(Hour >= 4f)) { moon.color = Color.Lerp(moonColor, moonFadeColor, Hour / 2f - 1f); moonObjectComponent.sharedMaterial.SetFloat("_MoonFade", 0.5f); RenderSettings.ambientLight = Color.Lerp(NightAmbientLight, TwilightAmbientLight, Hour / 2f - 1f); } if (!(Hour <= 4f) && !(Hour >= 6f)) { RenderSettings.ambientLight = Color.Lerp(TwilightAmbientLight, MorningAmbientLight, Hour / 2f - 2f); sun.color = Color.Lerp(SunNight, SunMorning, Hour / 2f - 2f); RenderSettings.fogColor = Color.Lerp(fogNightColor, fogMorningColor, Hour / 2f - 2f); SkyBoxMaterial.SetColor("_SkyTint", Color.Lerp(skyColorNight, skyColorMorning, Hour / 2f - 2f)); lightClouds1Component.material.SetColor("_Color", Color.Lerp(cloudColorNight, cloudColorMorning, Hour / 2f - 2f)); lightClouds1aComponent.material.SetColor("_Color", Color.Lerp(cloudColorNight, cloudColorMorning, Hour / 2f - 2f)); lerp = Mathf.Lerp(0.5f, 0f, Hour / 2f - 2f); moonObjectComponent.sharedMaterial.SetFloat("_MoonFade", lerp); if (sunShaftScript != null) { sunShaftScript.sunColor = Color.Lerp(DuskAtmosphericLight, MorningAtmosphericLight, Hour / 2f - 2f); } starSphereComponent.sharedMaterial.SetColor("_TintColor", Color.Lerp(starBrightness, moonFadeColor, Hour / 2f - 2f)); } if (!(Hour <= 6f) && !(Hour >= 8f)) { RenderSettings.ambientLight = Color.Lerp(MorningAmbientLight, MiddayAmbientLight, Hour / 2f - 3f); sun.color = Color.Lerp(SunMorning, SunDay, Hour / 2f - 3f); starSphereComponent.sharedMaterial.SetColor("_TintColor", starBrightness * fadeStars); RenderSettings.fogColor = Color.Lerp(fogMorningColor, fogDayColor, Hour / 2f - 3f); SkyBoxMaterial.SetColor("_SkyTint", Color.Lerp(skyColorMorning, skyColorDay, Hour / 2f - 3f)); lightClouds1Component.material.SetColor("_Color", Color.Lerp(cloudColorMorning, cloudColorDay, Hour / 2f - 3f)); lightClouds1aComponent.material.SetColor("_Color", Color.Lerp(cloudColorMorning, cloudColorDay, Hour / 2f - 3f)); if (sunShaftScript != null) { sunShaftScript.sunColor = Color.Lerp(MorningAtmosphericLight, MiddayAtmosphericLight, Hour / 2f - 3f); } starSphereComponent.sharedMaterial.SetColor("_TintColor", Color.black * fadeStars); moonObjectComponent.sharedMaterial.SetFloat("_MoonFade", 0f); fadeStars = 0f; } if (!(Hour <= 8f) && !(Hour >= 16f)) { RenderSettings.ambientLight = Color.Lerp(MiddayAmbientLight, MiddayAmbientLight, Hour / 2f - 4f); sun.color = Color.Lerp(SunDay, SunDay, Hour / 2f - 4f); starSphereComponent.sharedMaterial.SetColor("_TintColor", starBrightness * fadeStars); RenderSettings.fogColor = Color.Lerp(fogDayColor, fogDayColor, Hour / 2f - 4f); SkyBoxMaterial.SetColor("_SkyTint", Color.Lerp(skyColorDay, skyColorDay, Hour / 2f - 4f)); lightClouds1Component.material.SetColor("_Color", Color.Lerp(cloudColorDay, cloudColorDay, Hour / 2f - 4f)); lightClouds1aComponent.material.SetColor("_Color", Color.Lerp(cloudColorDay, cloudColorDay, Hour / 2f - 4f)); if (sunShaftScript != null) { sunShaftScript.sunColor = Color.Lerp(MiddayAtmosphericLight, MiddayAtmosphericLight, Hour / 2f - 4f); } starSphereComponent.sharedMaterial.SetColor("_TintColor", Color.black * fadeStars); moonObjectComponent.sharedMaterial.SetFloat("_MoonFade", 0f); fadeStars = 0f; } if (!(Hour <= 16f) && !(Hour >= 18f)) { RenderSettings.ambientLight = Color.Lerp(MiddayAmbientLight, DuskAmbientLight, Hour / 2f - 8f); sun.color = Color.Lerp(SunDay, SunDusk, Hour / 2f - 8f); RenderSettings.fogColor = Color.Lerp(fogDayColor, fogDuskColor, Hour / 2f - 8f); SkyBoxMaterial.SetColor("_SkyTint", Color.Lerp(skyColorDay, skyColorEvening, Hour / 2f - 8f)); lightClouds1Component.material.SetColor("_Color", Color.Lerp(cloudColorDay, cloudColorEvening, Hour / 2f - 8f)); lightClouds1aComponent.material.SetColor("_Color", Color.Lerp(cloudColorDay, cloudColorEvening, Hour / 2f - 8f)); moonObjectComponent.sharedMaterial.SetFloat("_MoonFade", 0f); if (sunShaftScript != null) { sunShaftScript.sunColor = Color.Lerp(MiddayAtmosphericLight, DuskAtmosphericLight, Hour / 2f - 8f); } starSphereComponent.sharedMaterial.SetColor("_TintColor", Color.black * fadeStars); fadeStars = 0f; } if (!(Hour <= 18f) && !(Hour >= 20f)) { RenderSettings.ambientLight = Color.Lerp(DuskAmbientLight, TwilightAmbientLight, Hour / 2f - 9f); sun.color = Color.Lerp(SunDusk, SunNight, Hour / 2f - 9f); RenderSettings.fogColor = Color.Lerp(fogDuskColor, fogNightColor, Hour / 2f - 9f); SkyBoxMaterial.SetColor("_SkyTint", Color.Lerp(skyColorEvening, skyColorNight, Hour / 2f - 9f)); lightClouds1Component.material.SetColor("_Color", Color.Lerp(cloudColorEvening, cloudColorNight, Hour / 2f - 9f)); lightClouds1aComponent.material.SetColor("_Color", Color.Lerp(cloudColorEvening, cloudColorNight, Hour / 2f - 9f)); moonObjectComponent.sharedMaterial.SetFloat("_FloatMax", Hour / 2f - 9f); if (sunShaftScript != null) { sunShaftScript.sunColor = Color.Lerp(DuskAtmosphericLight, DuskAtmosphericLight, Hour / 2f - 9f); } starSphereComponent.sharedMaterial.SetColor("_TintColor", Color.Lerp(Color.black, starBrightness, Hour / 2f - 9f)); lerp = Mathf.Lerp(0f, 0.5f, Hour / 2f - 9f); moonObjectComponent.sharedMaterial.SetFloat("_MoonFade", lerp); if (!(fadeStars < 1f)) { fadeStars = 1f; } } if (!(Hour <= 20f) && !(Hour >= 22f)) { RenderSettings.ambientLight = Color.Lerp(TwilightAmbientLight, NightAmbientLight, Hour / 2f - 10f); } if (!(Hour <= 22f)) { RenderSettings.ambientLight = NightAmbientLight; } if (!(Hour <= 20f)) { sun.color = Color.Lerp(SunNight, SunNight, Hour / 2f - 10f); starSphereComponent.sharedMaterial.SetColor("_TintColor", starBrightness * fadeStars); lightClouds1Component.material.SetColor("_Color", cloudColorNight); lightClouds1aComponent.material.SetColor("_Color", cloudColorNight); SkyBoxMaterial.SetColor("_SkyTint", Color.Lerp(skyColorNight, skyColorNight, Hour / 2f - 10f)); moonObjectComponent.sharedMaterial.SetFloat("_MoonFade", 0.5f); RenderSettings.fogColor = Color.Lerp(fogNightColor, fogNightColor, Hour / 2f - 10f); moon.color = Color.Lerp(moonFadeColor, moonColor, Hour / 2f - 10f); sun.enabled = false; fadeStars = 1f; } if (!(Hour < 0f) && !(Hour > 4f)) { lightClouds1Component.material.SetColor("_Color", cloudColorNight); lightClouds1aComponent.material.SetColor("_Color", cloudColorNight); moonObjectComponent.sharedMaterial.SetFloat("_MoonFade", 0.5f); } if (!(Hour < 0f) && !(Hour > 2f)) { moonLight.color = moonColor; moonObjectComponent.sharedMaterial.SetFloat("_MoonFade", 0.5f); RenderSettings.ambientLight = NightAmbientLight; } if (!(Hour >= 4f)) { sun.color = Color.Lerp(SunNight, SunNight, Hour / 2f - 2f); starSphereComponent.sharedMaterial.SetColor("_TintColor", starBrightness * fadeStars); RenderSettings.fogColor = Color.Lerp(fogNightColor, fogNightColor, Hour / 2f - 2f); lightClouds1Component.material.SetColor("_Color", cloudColorNight); lightClouds1aComponent.material.SetColor("_Color", cloudColorNight); SkyBoxMaterial.SetColor("_SkyTint", Color.Lerp(skyColorNight, skyColorNight, Hour / 2f - 10f)); moonObjectComponent.sharedMaterial.SetFloat("_FogAmountMin", 0f); moonObjectComponent.sharedMaterial.SetFloat("_FogAmountMax", 50000f); fadeStars = 1f; } } public virtual void WeatherForecaster() { if (weatherForecaster == 1) { FadeInPrecipitation(); weatherString = "Foggy"; } if (weatherForecaster == 2) { FadeInPrecipitation(); if (temperature >= 33) { weatherString = "Light Rain"; } if (temperature <= 32) { weatherString = "Light Snow"; } } if (weatherForecaster == 3) { FadeInPrecipitation(); if (temperature >= 33) { weatherString = "Heavy Rain & Thunder Storm"; } if (temperature <= 32) { weatherString = "Heavy Snow"; } } if (weatherForecaster == 4) { FadeOutPrecipitation(); weatherString = "Partly Cloudy"; } if (weatherForecaster == 5) { FadeOutPrecipitation(); weatherForecaster = 3; } if (weatherForecaster == 6) { FadeOutPrecipitation(); weatherForecaster = 7; } if (weatherForecaster == 7) { FadeOutPrecipitation(); weatherString = "Mostly Clear"; } if (weatherForecaster == 8) { FadeOutPrecipitation(); weatherString = "Clear"; } if (weatherForecaster == 11) { FadeOutPrecipitation(); weatherString = "Mostly Cloudy"; } if (weatherForecaster == 9) { weatherForecaster = 1; } if (weatherForecaster == 10) { FadeOutPrecipitation(); weatherString = "Lighning Bugs"; } if (weatherForecaster == 12) { FadeInPrecipitation(); weatherString = "Heavy Rain (No Thunder)"; } if (weatherForecaster == 13) { FadeOutPrecipitation(); weatherString = "Falling Fall Leaves"; } } public virtual void OnGUI() { if (timeScrollBar) { startTime = GUI.HorizontalSlider(new Rect(25f, 25f, 200f, 30f), startTime, 0f, 0.99f); } if (commandPromptActive) { stringToEdit = GUI.TextField(new Rect(10f, 430f, 40f, 20f), stringToEdit, 10); if (GUI.Button(new Rect(10f, 450f, 60f, 40f), "Change")) { weatherCommandPrompt(); } } } public virtual void weatherCommandPrompt() { if (stringToEdit == foggy) { weatherForecaster = 1; MonoBehaviour.print("Weather Forced: Foggy"); } if (stringToEdit == lightRain_lightSnow) { weatherForecaster = 2; MonoBehaviour.print("Weather Forced: Light Rain/Light Snow (Winter Only)"); } if (stringToEdit == rainStorm_snowStorm) { weatherForecaster = 3; MonoBehaviour.print("Weather Forced: Tunder Storm/Snow Storm (Winter Only)"); } if (stringToEdit == partlyCloudy1) { weatherForecaster = 4; MonoBehaviour.print("Weather Forced: Partly Cloudy"); } if (stringToEdit == partlyCloudy2) { weatherForecaster = 4; MonoBehaviour.print("Weather Forced: Partly Cloudy"); } if (stringToEdit == partlyCloudy3) { weatherForecaster = 4; MonoBehaviour.print("Weather Forced: Partly Cloudy"); } if (stringToEdit == clear1) { weatherForecaster = 7; MonoBehaviour.print("Weather Forced: Mostly Clear"); } if (stringToEdit == clear2) { weatherForecaster = 8; MonoBehaviour.print("Weather Forced: Sunny"); } if (stringToEdit == cloudy) { weatherForecaster = 7; MonoBehaviour.print("Weather Forced: Sunny"); } if (stringToEdit == butterfliesSummer) { weatherForecaster = 10; MonoBehaviour.print("Weather Forced: Lightning Bugs (Summer Only)"); } if (stringToEdit == mostlyCloudy) { weatherForecaster = 11; MonoBehaviour.print("Weather Forced: Mostly Cloudy"); } if (stringToEdit == heavyRain) { weatherForecaster = 12; MonoBehaviour.print("Weather Forced: Heavy Rain (No Thunder)"); } if (stringToEdit == fallLeaves) { weatherForecaster = 13; MonoBehaviour.print("Weather Forced: Falling Fall Leaves (Fall Only)"); } } public virtual void Lightning() { timer += Time.deltaTime; if (!(timer < lightningOdds) && !lightingGenerated) { lightingGenerated = true; lightSourceComponent.enabled = true; lightningNumber = UnityEngine.Random.Range(1, 5); if (lightningNumber == 1) { soundComponent.PlayOneShot(thunderSound1); } if (lightningNumber == 2) { soundComponent.PlayOneShot(thunderSound2); } if (lightningNumber == 3) { soundComponent.PlayOneShot(thunderSound3); } if (lightningNumber == 4) { soundComponent.PlayOneShot(thunderSound4); } if (lightningNumber == 5) { soundComponent.PlayOneShot(thunderSound5); } UnityEngine.Object.Instantiate(lightningBolt1, lightningSpawn.position, lightningSpawn.rotation); } if (lightingGenerated) { if (!fadeLightning) { lightSourceComponent.intensity += 0.22f; } if (!(lightSourceComponent.intensity < lightningIntensity) && !fadeLightning) { lightSourceComponent.intensity = lightningIntensity; fadeLightning = true; } } if (fadeLightning) { onTimer += Time.deltaTime; if (!(onTimer < lightningFlashLength)) { lightSourceComponent.intensity -= 0.14f; } if (!(lightSourceComponent.intensity > 0f)) { lightSourceComponent.intensity = 0f; fadeLightning = false; lightingGenerated = false; timer = 0f; onTimer = 0f; lightSourceComponent.enabled = false; lightSourceComponent.transform.rotation = Quaternion.Euler(50f, UnityEngine.Random.Range(0, 360), 0f); lightningOdds = UnityEngine.Random.Range(lightningMinChance, lightningMaxChance); lightningIntensity = UnityEngine.Random.Range(minIntensity, maxIntensity); } } } public virtual void LogErrorCheck() { if (rain == null) { Debug.LogError("Rain System Null Reference: There is no Rain Particle System, make sure there is one assigned to the Rain Particle System slot of the UniStorm Editor. "); } if (snow == null) { Debug.LogError("Snow System Null Reference: There is no Snow Particle System, make sure there is one assigned to the Snow Particle System slot of the UniStorm Editor. "); } if (butterflies == null) { Debug.LogError("Butterflies System Null Reference: There is no Butterflies Particle System, make sure there is one assigned to the Butterflies Particle System slot of the UniStorm Editor. "); } if (mistFog == null) { Debug.LogError("Mist System Null Reference: There is no Mist Particle System, make sure there is one assigned to the Mist Particle System slot of the UniStorm Editor. "); } if (snowMistFog == null) { Debug.LogError("Snow Dust System Null Reference: There is no Snow Dust Particle System, make sure there is one assigned to the Snow Dust Particle System slot of the UniStorm Editor. "); } if (windyLeaves == null) { Debug.LogError("Windy Leaves System Null Reference: There is no Windy Leaves Particle System, make sure there is one assigned to the Windy Leaves Particle System slot of the UniStorm Editor. "); } if (windZone == null) { Debug.LogError("Wind Zone Null Reference: There is no Wind Zone System, make sure there is one assigned to the Wind Zone System slot of the UniStorm Editor. "); } if (SkyBoxMaterial == null) { Debug.LogError("Sky Box Material Null Reference: There is a missing Sky Box Material, make sure there is one assigned to each of the Sky Box Material slots of the UniStorm Editor. "); } if (moonPhase1 == null || moonPhase2 == null || moonPhase3 == null || moonPhase4 == null || moonPhase5 == null || moonPhase6 == null || moonPhase7 == null || moonPhase8 == null) { Debug.LogError("Moon Phase Material Null Reference: There is a missing Moon Phase Material, make sure there is one assigned to each of the Moon Phase Material slots of the UniStorm Editor. "); } if (lightClouds1 == null || lightClouds2 == null || lightClouds3 == null || lightClouds4 == null || lightClouds5 == null || heavyClouds == null || heavyCloudsLayer1 == null || heavyCloudsLayerLight == null || mostlyCloudyClouds == null) { Debug.LogError("Cloud GameObject Null Reference: There is a missing Cloud GameObject, make sure there is one assigned to each of the Cloud GameObject slots of the UniStorm Editor. "); } if (starSphere == null) { Debug.LogError("Sky Sphere GameObject Null Reference: There is a missing Sky Sphere GameObject, make sure there is one assigned to both the Star Sphere and Gradient Sphere slots of the UniStorm Editor. "); } if (moonObject == null) { Debug.LogError("Moon GameObject Null Reference: The Moon GameObject is missing, make sure there it is assigned to the Moon GameObject slot of the UniStorm Editor. "); } if (sun == null) { Debug.LogError("Sun GameObject Null Reference: The Sun GameObject is missing, make sure it is assigned to the Sun GameObject slot of the UniStorm Editor. "); } if (moon == null) { Debug.LogError("Moon GameObject Null Reference: The Moon GameObject is missing, make sure it is assigned to the Moon GameObject slot of the UniStorm Editor. "); } if (lightSource == null) { Debug.LogError("Lightning Light GameObject Null Reference: The Lightning Light GameObject is missing, make sure it is assigned to the Lightning Light GameObject slot of the UniStorm Editor. "); } if (rainSound == null || windSound == null || windSnowSound == null) { Debug.LogError("Weather Sound Effect Null Reference: There is a missing Weather Sound Effect, make sure there is one assigned to each of the Weather Sound Effect slots of the UniStorm Editor."); } if (thunderSound1 == null || thunderSound2 == null || thunderSound3 == null || thunderSound4 == null || thunderSound5 == null) { Debug.LogError("Weather Sound Effect Null Reference: There is a missing Thunder Sound Effect, make sure there is one assigned to each of the Thunder Sound Effect slots of the UniStorm Editor."); } if (lightningBolt1 == null) { Debug.LogError("Lightning Bolt Null Reference: The Lightning Bolt is missing, make sure there is one attached to the UniStorm UniStorm Editor."); } if (lightningSpawn == null) { Debug.LogError("Lightning Bolt Spawn Null Reference: The Lightning Bolt Spawn is missing, make sure there is one attached to the UniStorm UniStorm Editor."); } } public virtual void DynamicCloudFormations() { if (cloudType == 1) { uvOffsetA += uvAnimationRateA * Time.deltaTime * cloudSpeed * 0.1f; uvOffsetB += uvAnimationRateB * Time.deltaTime * cloudSpeed * 0.1f; uvOffsetC += uvAnimationRateB * Time.deltaTime * cloudSpeed * 0.1f; lightClouds1Component.materials[materialIndex].SetTextureOffset(CloudA, uvOffsetB); lightClouds1Component.materials[materialIndex].SetTextureOffset(CloudB, uvOffsetB); lightClouds1Component.materials[materialIndex].SetTextureOffset(CloudC, uvOffsetC); partlyCloudyClouds1Component.materials[materialIndex].SetTextureOffset(CloudA, uvOffsetB); partlyCloudyClouds1Component.materials[materialIndex].SetTextureOffset(CloudB, uvOffsetB); partlyCloudyClouds1Component.materials[materialIndex].SetTextureOffset(CloudC, uvOffsetB); mostlyCloudyClouds1Component.materials[materialIndex].SetTextureOffset(CloudA, uvOffsetB); mostlyCloudyClouds1Component.materials[materialIndex].SetTextureOffset(CloudB, uvOffsetB); mostlyCloudyClouds1Component.materials[materialIndex].SetTextureOffset(CloudC, uvOffsetB); mostlyCloudyClouds2Component.materials[materialIndex].SetTextureOffset(CloudA, uvOffsetB); mostlyCloudyClouds2Component.materials[materialIndex].SetTextureOffset(CloudB, uvOffsetB); mostlyCloudyClouds2Component.materials[materialIndex].SetTextureOffset(CloudC, uvOffsetB); if (cloudDensity == 2) { lightClouds1aComponent.materials[materialIndex].SetTextureOffset(CloudA, uvOffsetB); lightClouds1aComponent.materials[materialIndex].SetTextureOffset(CloudB, uvOffsetB); lightClouds1aComponent.materials[materialIndex].SetTextureOffset(CloudC, uvOffsetC); partlyCloudyClouds2Component.materials[materialIndex].SetTextureOffset(CloudA, uvOffsetB); partlyCloudyClouds2Component.materials[materialIndex].SetTextureOffset(CloudB, uvOffsetB); partlyCloudyClouds2Component.materials[materialIndex].SetTextureOffset(CloudC, uvOffsetB); } uvOffsetHeavyA += uvAnimationRateHeavyA * Time.deltaTime * heavyCloudSpeed * 0.1f; uvOffsetHeavyB += uvAnimationRateHeavyB * Time.deltaTime * heavyCloudSpeed * 0.1f; uvOffsetHeavyC += uvAnimationRateHeavyB * Time.deltaTime * heavyCloudSpeed * 0.1f; heavyCloudsLayerLightComponent.materials[materialIndex].SetTextureOffset(CloudA, uvOffsetHeavyA); heavyCloudsLayerLightComponent.materials[materialIndex].SetTextureOffset(CloudB, uvOffsetHeavyB); heavyCloudsLayerLightComponent.materials[materialIndex].SetTextureOffset(CloudC, uvOffsetHeavyC); } } public virtual void DynamicTimeOfDaySounds() { TODSoundsTimer += Time.deltaTime; if (!(TODSoundsTimer < (float)timeToWaitCurrent) && !(Hour <= 4f) && !(Hour >= 8f) && !playedSound && useMorningSounds) { soundComponent.PlayOneShot(ambientSoundsMorning[UnityEngine.Random.Range(0, ambientSoundsMorning.Count)]); playedSound = true; } if (!(TODSoundsTimer <= (float)timeToWaitCurrent) && !(Hour <= 8f) && !(Hour >= 16f) && !playedSound && useDaySounds) { soundComponent.PlayOneShot(ambientSoundsDay[UnityEngine.Random.Range(0, ambientSoundsDay.Count)]); playedSound = true; } if (!(TODSoundsTimer <= (float)timeToWaitCurrent) && !(Hour <= 16f) && !(Hour >= 20f) && !playedSound && useEveningSounds) { soundComponent.PlayOneShot(ambientSoundsEvening[UnityEngine.Random.Range(0, ambientSoundsEvening.Count)]); playedSound = true; } if (!(TODSoundsTimer <= (float)timeToWaitCurrent) && !(Hour <= 20f) && !(Hour >= 25f) && !playedSound && useNightSounds) { soundComponent.PlayOneShot(ambientSoundsNight[UnityEngine.Random.Range(0, ambientSoundsNight.Count)]); playedSound = true; } if (!(TODSoundsTimer <= (float)timeToWaitCurrent) && !(Hour <= 0f) && !(Hour >= 4f) && !playedSound && useNightSounds) { soundComponent.PlayOneShot(ambientSoundsNight[UnityEngine.Random.Range(0, ambientSoundsNight.Count)]); playedSound = true; } if (!(TODSoundsTimer < (float)(timeToWaitCurrent + 2))) { timeToWaitCurrent = UnityEngine.Random.Range(timeToWaitMin, timeToWaitMax); TODSoundsTimer = 0f; playedSound = false; } } public virtual void FadeOutPrecipitation() { topStormCloudFade -= Time.deltaTime * 0.04f; fade2 -= Time.deltaTime * 0.06f; fadeStormClouds -= Time.deltaTime * 0.04f; windControl -= Time.deltaTime; time -= Time.deltaTime * 0.14f; sunShaftFade += Time.deltaTime * 0.14f; minRainIntensity -= 1f; minFogIntensity -= 0.04f; minHeavyRainMistIntensity -= 0.08f; minSnowFogIntensity -= 0.024f; minSnowIntensity -= 0.9f; stormClouds -= Time.deltaTime * 0.011f; sunIntensity += 0.0015f; sun.enabled = true; dynamicSnowFade -= Time.deltaTime * 0.0095f; overrideFog = false; heavyCloudsComponent.material.color = new Color(stormCloudColor1.r, stormCloudColor1.g, stormCloudColor1.b, topStormCloudFade); heavyCloudsLayer1Component.material.color = new Color(0f, 0f, 0f, fade2); heavyCloudsLayerLightComponent.material.color = new Color(stormCloudColor2.r, stormCloudColor2.g, stormCloudColor2.b, fade2); moonLight.intensity += 0.001f; if (!(moonLight.intensity < moonLightIntensity)) { moonLight.intensity = moonLightIntensity; } if (weatherForecaster == 13 && monthCounter >= 8 && monthCounter <= 10) { windyLeavesFade += 0.04f; if (!(windyLeavesFade < 6f)) { windyLeavesFade = 6f; } } else { windyLeavesFade -= 0.04f; if (!(windyLeavesFade > 0f)) { windyLeavesFade = 0f; } } if (weatherForecaster == 10 && monthCounter >= 5 && monthCounter <= 7) { butterfliesFade += 0.04f; if (!(butterfliesFade < 8f)) { butterfliesFade = 8f; } } else { butterfliesFade -= 0.04f; if (!(butterfliesFade > 0f)) { butterfliesFade = 0f; } } if (terrainDetection) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = Terrain.activeTerrain.terrainData.wavingGrassSpeed - 0.00025f; Terrain.activeTerrain.terrainData.wavingGrassAmount = Terrain.activeTerrain.terrainData.wavingGrassAmount - 0.00025f; Terrain.activeTerrain.terrainData.wavingGrassStrength = Terrain.activeTerrain.terrainData.wavingGrassStrength - 0.00025f; if (!(Terrain.activeTerrain.terrainData.wavingGrassSpeed > normalGrassWavingSpeed)) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = normalGrassWavingSpeed; } if (!(Terrain.activeTerrain.terrainData.wavingGrassAmount > normalGrassWavingStrength)) { Terrain.activeTerrain.terrainData.wavingGrassAmount = normalGrassWavingStrength; } if (!(Terrain.activeTerrain.terrainData.wavingGrassStrength > normalGrassWavingAmount)) { Terrain.activeTerrain.terrainData.wavingGrassStrength = normalGrassWavingAmount; } } if (RenderSettings.fogMode == FogMode.Linear) { RenderSettings.fogStartDistance += 0.75f; RenderSettings.fogEndDistance += 0.75f; if (!(RenderSettings.fogStartDistance < (float)fogStartDistance)) { RenderSettings.fogStartDistance = fogStartDistance; } if (!(RenderSettings.fogEndDistance < (float)fogEndDistance)) { RenderSettings.fogEndDistance = fogEndDistance; } } if (!(fade2 > 0f)) { fade2 = 0f; } if (cloudType == 2 && weatherForecaster == 4) { lightClouds2Component.enabled = true; lightClouds3Component.enabled = false; lightClouds4Component.enabled = false; lightClouds5Component.enabled = false; highClouds1Component.enabled = true; highClouds2Component.enabled = false; mostlyCloudyCloudsComponent.enabled = false; } if (cloudType == 2 && weatherForecaster == 5) { lightClouds2Component.enabled = false; lightClouds3Component.enabled = true; lightClouds4Component.enabled = true; lightClouds5Component.enabled = false; highClouds1Component.enabled = false; highClouds2Component.enabled = true; mostlyCloudyCloudsComponent.enabled = false; } if (cloudType == 2 && weatherForecaster == 5) { lightClouds2Component.enabled = false; lightClouds3Component.enabled = false; lightClouds4Component.enabled = false; lightClouds5Component.enabled = true; highClouds1Component.enabled = false; highClouds2Component.enabled = false; mostlyCloudyCloudsComponent.enabled = false; } if (weatherForecaster == 11) { partlyCloudyFader += 0.0015f; mostlyCloudyFader += 0.0015f; colorFader += 0.0015f; cloudColorMorning.a = colorFader; cloudColorDay.a = colorFader; cloudColorEvening.a = colorFader; cloudColorNight.a = colorFader; if (cloudType == 1) { partlyCloudyClouds1Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, partlyCloudyFader); partlyCloudyClouds2Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, partlyCloudyFader); mostlyCloudyClouds1Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, mostlyCloudyFader); mostlyCloudyClouds2Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, mostlyCloudyFader); if (!(mostlyCloudyFader < 1f)) { mostlyCloudyFader = 1f; } if (!(partlyCloudyFader < 1f)) { partlyCloudyFader = 1f; } if (!(colorFader < 1f)) { colorFader = 1f; } } } if (weatherForecaster == 4 || weatherForecaster == 5 || weatherForecaster == 6) { partlyCloudyFader += 0.0015f; mostlyCloudyFader -= 0.0015f; colorFader += 0.0015f; cloudColorMorning.a = colorFader; cloudColorDay.a = colorFader; cloudColorEvening.a = colorFader; cloudColorNight.a = colorFader; if (cloudType == 1) { partlyCloudyClouds1Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, partlyCloudyFader); partlyCloudyClouds2Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, partlyCloudyFader); mostlyCloudyClouds1Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, mostlyCloudyFader); mostlyCloudyClouds2Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, mostlyCloudyFader); if (!(mostlyCloudyFader > 0f)) { mostlyCloudyFader = 0f; } if (!(partlyCloudyFader < 1f)) { partlyCloudyFader = 1f; } if (!(colorFader < 1f)) { colorFader = 1f; } } } if (cloudType == 2 && weatherForecaster == 7) { lightClouds2Component.enabled = false; lightClouds3Component.enabled = false; lightClouds5Component.enabled = false; lightClouds4Component.enabled = false; highClouds1Component.enabled = true; highClouds2Component.enabled = false; mostlyCloudyCloudsComponent.enabled = false; } if (weatherForecaster == 7) { partlyCloudyFader -= 0.0025f; mostlyCloudyFader -= 0.0015f; colorFader += 0.0025f; cloudColorMorning.a = colorFader; cloudColorDay.a = colorFader; cloudColorEvening.a = colorFader; cloudColorNight.a = colorFader; if (cloudType == 1) { partlyCloudyClouds1Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, partlyCloudyFader); partlyCloudyClouds2Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, partlyCloudyFader); mostlyCloudyClouds1Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, mostlyCloudyFader); mostlyCloudyClouds2Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, mostlyCloudyFader); if (!(mostlyCloudyFader > 0f)) { mostlyCloudyFader = 0f; } if (!(partlyCloudyFader > 0f)) { partlyCloudyFader = 0f; } if (!(colorFader < 1f)) { colorFader = 1f; } } } if (cloudType == 2 && weatherForecaster == 8) { lightClouds2Component.enabled = false; lightClouds3Component.enabled = false; lightClouds5Component.enabled = false; lightClouds4Component.enabled = false; highClouds1Component.enabled = false; highClouds2Component.enabled = false; mostlyCloudyCloudsComponent.enabled = false; } if (weatherForecaster == 8) { partlyCloudyFader -= 0.0025f; mostlyCloudyFader -= 0.0015f; colorFader -= 0.0025f; cloudColorMorning.a = colorFader; cloudColorDay.a = colorFader; cloudColorEvening.a = colorFader; cloudColorNight.a = colorFader; if (cloudType == 1) { partlyCloudyClouds1Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, partlyCloudyFader); partlyCloudyClouds2Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, partlyCloudyFader); mostlyCloudyClouds1Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, mostlyCloudyFader); mostlyCloudyClouds2Component.material.color = new Color(lightClouds1Component.material.color.r, lightClouds1Component.material.color.g, lightClouds1Component.material.color.b, mostlyCloudyFader); if (!(mostlyCloudyFader > 0f)) { mostlyCloudyFader = 0f; } if (!(partlyCloudyFader > 0f)) { partlyCloudyFader = 0f; } if (!(colorFader > 0f)) { colorFader = 0f; } } } butterflies.emissionRate = butterfliesFade; snow.emissionRate = minSnowIntensity; snowMistFog.emissionRate = minSnowFogIntensity; rain.emissionRate = minRainIntensity; rainMist.emissionRate = minHeavyRainMistIntensity; mistFogComponent.minEmission = minFogIntensity; mistFogComponent.maxEmission = minFogIntensity; windyLeaves.emissionRate = windyLeavesFade; if (!(dynamicSnowFade > 0.25f)) { dynamicSnowFade = 0.25f; } if (!(minSnowIntensity > 0f)) { minSnowIntensity = 0f; } if (!(minSnowFogIntensity > 0f)) { minSnowFogIntensity = 0f; } rainSoundComponent.volume -= Time.deltaTime * 0.07f; windSoundComponent.volume -= Time.deltaTime * 0.04f; windSnowSoundComponent.volume -= Time.deltaTime * 0.04f; if (!(stormClouds > 0f)) { stormClouds = 0f; } if (!(minRainIntensity > 0f)) { minRainIntensity = 0f; windZone.transform.rotation = Quaternion.AngleAxis(0f, Vector3.up); windZone.gameObject.SetActive(false); if (!(windZone.transform.eulerAngles.y > 1f)) { windZone.transform.eulerAngles = new Vector3(0f, 0f, 0f); windZone.gameObject.SetActive(false); } } if (!(minRainIntensity < 1f)) { windZone.transform.Rotate(-Vector3.up * Time.deltaTime * 12f); if (!(windZone.transform.eulerAngles.y > 1f)) { windZone.transform.eulerAngles = new Vector3(0f, 0f, 0f); } } if (!(minFogIntensity > 0f)) { minFogIntensity = 0f; } if (!(minHeavyRainMistIntensity > 0f)) { minHeavyRainMistIntensity = 0f; } if (!(topStormCloudFade > 0f)) { topStormCloudFade = 0f; } if (!(fadeStormClouds > 0f)) { fadeStormClouds = 0f; } if (!(time > 0f)) { time = 0f; } if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity += 0.005f; } if (sunShaftScript != null && !(sunShaftScript.sunShaftIntensity < 2f)) { sunShaftScript.sunShaftIntensity = 2f; sun.enabled = true; RenderSettings.fogDensity += 0.00012f * Time.deltaTime; if (!(RenderSettings.fogDensity < fogDensity)) { RenderSettings.fogDensity = fogDensity; } } } public virtual void FadeInPrecipitation() { topStormCloudFade += Time.deltaTime * 0.015f; fade2 += Time.deltaTime * 0.015f; butterfliesFade -= 0.04f; windyLeavesFade -= 0.04f; fadeHorizonController += Time.deltaTime * 0.04f; fadeStormClouds += Time.deltaTime * 0.04f; time += Time.deltaTime * 0.0014f; windControlUp += 1f; sunShaftFade -= Time.deltaTime * 0.14f; stormClouds += Time.deltaTime * 0.011f; sunIntensity -= 0.002f; dynamicSnowFade -= Time.deltaTime * 0.0095f; if (weatherForecaster == 1) { minRainIntensity -= 0.2f; minFogIntensity -= 0.008f; minHeavyRainMistIntensity -= 0.008f; minSnowFogIntensity -= 0.024f; minSnowIntensity -= 0.9f; rainSoundComponent.volume -= Time.deltaTime * 0.07f; windSoundComponent.volume -= Time.deltaTime * 0.04f; windSnowSoundComponent.volume -= Time.deltaTime * 0.04f; if (!(minFogIntensity > 0f)) { minFogIntensity = 0f; } if (!(minHeavyRainMistIntensity > 0f)) { minHeavyRainMistIntensity = 0f; } if (!(minSnowIntensity > 0f)) { minSnowIntensity = 0f; } if (!(minSnowFogIntensity > 0f)) { minSnowFogIntensity = 0f; } } if ((temperature >= 33 && temperatureType == 1 && weatherForecaster == 2) || (temperatureType == 2 && temperature >= 1 && weatherForecaster == 2)) { rainSoundComponent.volume += Time.deltaTime * 0.01f; if (!(fade2 < 0.3f)) { minRainIntensity += 0.2f; } minFogIntensity -= 0.008f; if (!(minRainIntensity < maxLightRainIntensity)) { minRainIntensity = maxLightRainIntensity; } if (!(minFogIntensity > 0f)) { minFogIntensity = 0f; } if (!(minHeavyRainMistIntensity > 0f)) { minHeavyRainMistIntensity = 0f; } if (!(windSoundComponent.volume < 0f)) { windSoundComponent.volume = 0f; } if (!(rainSoundComponent.volume < 0.3f)) { rainSoundComponent.volume = 0.3f; } if (lastWeatherType != weatherForecaster && randomizedPrecipitation) { randomizedRainIntensity = (int)UnityEngine.Random.Range(100f, maxLightRainIntensity); currentGeneratedIntensity = randomizedRainIntensity; lastWeatherType = weatherForecaster; } if (!randomizedPrecipitation && !(minRainIntensity < maxLightRainIntensity)) { minRainIntensity = maxLightRainIntensity; } if (randomizedPrecipitation && !(minRainIntensity < (float)currentGeneratedIntensity)) { minRainIntensity = currentGeneratedIntensity; } } if ((temperature >= 33 && temperatureType == 1 && weatherForecaster == 3) || (temperatureType == 2 && temperature >= 1 && weatherForecaster == 3) || (temperature >= 33 && temperatureType == 1 && weatherForecaster == 12) || (temperatureType == 2 && temperature >= 1 && weatherForecaster == 12)) { if (!(fade2 < 0.3f)) { minRainIntensity += 0.2f; minFogIntensity += 0.008f; minHeavyRainMistIntensity += 0.008f; } minSnowFogIntensity -= 0.024f; minSnowIntensity -= 0.9f; rainSoundComponent.volume += Time.deltaTime * 0.01f; windSoundComponent.volume += Time.deltaTime * 0.01f; if (weatherForecaster == 3 && !(minRainIntensity < 150f)) { Lightning(); } if (!randomizedPrecipitation && !(minRainIntensity < maxStormRainIntensity)) { minRainIntensity = maxStormRainIntensity; } if (randomizedPrecipitation && !(minRainIntensity < (float)currentGeneratedIntensity)) { minRainIntensity = currentGeneratedIntensity; } if (lastWeatherType != weatherForecaster && randomizedPrecipitation) { randomizedRainIntensity = (int)UnityEngine.Random.Range(400f, maxStormRainIntensity); currentGeneratedIntensity = randomizedRainIntensity; lastWeatherType = weatherForecaster; } if (!(minRainIntensity < maxStormRainIntensity)) { minRainIntensity = maxStormRainIntensity; } if (!(minFogIntensity < maxStormMistCloudsIntensity)) { minFogIntensity = maxStormMistCloudsIntensity; } if (!(minHeavyRainMistIntensity < (float)maxHeavyRainMistIntensity)) { minHeavyRainMistIntensity = maxHeavyRainMistIntensity; } if (!(minSnowIntensity > 0f)) { minSnowIntensity = 0f; } if (!(minSnowFogIntensity > 0f)) { minSnowFogIntensity = 0f; } } if ((temperature <= 32 && temperatureType == 1 && weatherForecaster == 3) || (temperatureType == 2 && temperature <= 0 && weatherForecaster == 3) || (temperature <= 32 && temperatureType == 1 && weatherForecaster == 12)) { lightSourceComponent.enabled = false; if (!(fade2 < 0.3f)) { minSnowIntensity += 0.2f; minSnowFogIntensity += 0.008f; } minRainIntensity -= 1f; minFogIntensity -= 0.04f; minHeavyRainMistIntensity -= 0.08f; rainSoundComponent.volume -= Time.deltaTime * 0.04f; windSnowSoundComponent.volume += Time.deltaTime * 0.01f; windSoundComponent.volume -= Time.deltaTime * 0.04f; if (lastWeatherType != weatherForecaster && randomizedPrecipitation) { randomizedRainIntensity = (int)UnityEngine.Random.Range(100f, maxSnowStormIntensity); currentGeneratedIntensity = randomizedRainIntensity; lastWeatherType = weatherForecaster; } if (!randomizedPrecipitation && !(minSnowIntensity < maxSnowStormIntensity)) { minSnowIntensity = maxSnowStormIntensity; } if (randomizedPrecipitation && !(minSnowIntensity < (float)currentGeneratedIntensity)) { minSnowIntensity = currentGeneratedIntensity; } if (!(minSnowIntensity < maxSnowStormIntensity)) { minSnowIntensity = maxSnowStormIntensity; } if (!(minSnowFogIntensity < maxHeavySnowDustIntensity)) { minSnowFogIntensity = maxHeavySnowDustIntensity; } if (!(minRainIntensity > 0f)) { minRainIntensity = 0f; } if (!(minFogIntensity > 0f)) { minFogIntensity = 0f; } if (!(minHeavyRainMistIntensity > 0f)) { minHeavyRainMistIntensity = 0f; } } if ((temperature <= 32 && temperatureType == 1 && weatherForecaster == 2) || (temperatureType == 2 && temperature <= 0 && weatherForecaster == 2)) { lightSourceComponent.enabled = false; if (!(fade2 < 0.3f)) { minSnowIntensity += 0.2f; minSnowFogIntensity += 0.008f; } minRainIntensity -= 1f; minFogIntensity -= 0.04f; minHeavyRainMistIntensity -= 0.08f; windSnowSoundComponent.volume += Time.deltaTime * 0.01f; windSoundComponent.volume -= Time.deltaTime * 0.04f; rainSoundComponent.volume -= Time.deltaTime * 0.04f; if (lastWeatherType != weatherForecaster && randomizedPrecipitation) { randomizedRainIntensity = (int)UnityEngine.Random.Range(100f, maxLightSnowIntensity); currentGeneratedIntensity = randomizedRainIntensity; lastWeatherType = weatherForecaster; } if (!randomizedPrecipitation && !(minSnowIntensity < maxLightSnowIntensity)) { minSnowIntensity = maxLightSnowIntensity; } if (randomizedPrecipitation && !(minSnowIntensity < (float)currentGeneratedIntensity)) { minSnowIntensity = currentGeneratedIntensity; } if (!(minSnowIntensity < maxLightSnowIntensity)) { minSnowIntensity = maxLightSnowIntensity; } if (!(minSnowFogIntensity < maxLightSnowDustIntensity)) { minSnowFogIntensity = maxLightSnowDustIntensity; } if (!(minRainIntensity > 0f)) { minRainIntensity = 0f; } if (!(minFogIntensity > 0f)) { minFogIntensity = 0f; } if (!(minHeavyRainMistIntensity > 0f)) { minHeavyRainMistIntensity = 0f; } if (!(windSnowSoundComponent.volume < 0.3f)) { windSnowSoundComponent.volume = 0.3f; } } if (terrainDetection) { if (weatherForecaster == 3 || weatherForecaster == 12) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = Terrain.activeTerrain.terrainData.wavingGrassSpeed + 8E-05f; Terrain.activeTerrain.terrainData.wavingGrassAmount = Terrain.activeTerrain.terrainData.wavingGrassAmount + 8E-05f; Terrain.activeTerrain.terrainData.wavingGrassStrength = Terrain.activeTerrain.terrainData.wavingGrassStrength + 8E-05f; if (!(Terrain.activeTerrain.terrainData.wavingGrassSpeed < stormGrassWavingSpeed)) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = stormGrassWavingSpeed; } if (!(Terrain.activeTerrain.terrainData.wavingGrassAmount < stormGrassWavingStrength)) { Terrain.activeTerrain.terrainData.wavingGrassAmount = stormGrassWavingStrength; } if (!(Terrain.activeTerrain.terrainData.wavingGrassStrength < stormGrassWavingAmount)) { Terrain.activeTerrain.terrainData.wavingGrassStrength = stormGrassWavingAmount; } } if (weatherForecaster == 1 || weatherForecaster == 2) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = Terrain.activeTerrain.terrainData.wavingGrassSpeed - 0.00025f; Terrain.activeTerrain.terrainData.wavingGrassAmount = Terrain.activeTerrain.terrainData.wavingGrassAmount - 0.00025f; Terrain.activeTerrain.terrainData.wavingGrassStrength = Terrain.activeTerrain.terrainData.wavingGrassStrength - 0.00025f; if (!(Terrain.activeTerrain.terrainData.wavingGrassSpeed > normalGrassWavingSpeed)) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = normalGrassWavingSpeed; } if (!(Terrain.activeTerrain.terrainData.wavingGrassAmount > normalGrassWavingStrength)) { Terrain.activeTerrain.terrainData.wavingGrassAmount = normalGrassWavingStrength; } if (!(Terrain.activeTerrain.terrainData.wavingGrassStrength > normalGrassWavingAmount)) { Terrain.activeTerrain.terrainData.wavingGrassStrength = normalGrassWavingAmount; } } } if (!(sunIntensity > HeavyRainSunIntensity)) { sunIntensity = HeavyRainSunIntensity; } moonLight.intensity -= 0.001f; if (!(moonLight.intensity > stormyMoonLightIntensity)) { moonLight.intensity = stormyMoonLightIntensity; } if (RenderSettings.fogMode == FogMode.Linear) { RenderSettings.fogStartDistance -= 0.75f; RenderSettings.fogEndDistance -= 0.75f; if (!(RenderSettings.fogStartDistance > (float)stormyFogDistanceStart)) { RenderSettings.fogStartDistance = stormyFogDistanceStart; } if (!(RenderSettings.fogEndDistance > (float)stormyFogDistance)) { RenderSettings.fogEndDistance = stormyFogDistance; } } if (!(minRainIntensity < 1f)) { windZone.transform.Rotate(Vector3.up * Time.deltaTime * 3f); windZone.gameObject.SetActive(true); } if (!(windZone.transform.eulerAngles.y < 180f)) { windZone.transform.eulerAngles = new Vector3(0f, 180f, 0f); } if (!(dynamicSnowFade > 0.25f)) { dynamicSnowFade = 0.25f; } heavyCloudsComponent.material.color = new Color(stormCloudColor1.r, stormCloudColor1.g, stormCloudColor1.b, topStormCloudFade); heavyCloudsLayer1Component.material.color = new Color(0f, 0f, 0f, fade2); heavyCloudsLayerLightComponent.material.color = new Color(stormCloudColor2.r, stormCloudColor2.g, stormCloudColor2.b, fade2); if (!(fade2 < 0.75f)) { fade2 = 0.75f; } if (!(butterfliesFade > 0f)) { butterfliesFade = 0f; } butterflies.emissionRate = butterfliesFade; snow.emissionRate = minSnowIntensity; snowMistFog.emissionRate = minSnowFogIntensity; rain.emissionRate = minRainIntensity; rainMist.emissionRate = minHeavyRainMistIntensity; mistFogComponent.minEmission = minFogIntensity; mistFogComponent.maxEmission = minFogIntensity; windyLeaves.emissionRate = windyLeavesFade; RenderSettings.fogDensity -= 0.00012f * Time.deltaTime; if (!(RenderSettings.fogDensity > 0.0006f)) { RenderSettings.fogDensity = 0.0006f; if (overrideFog) { } } if (overrideFog) { } if (!(stormClouds < 0.55f)) { stormClouds = 0.55f; } if (!(fade2 < 0.75f)) { fade2 = 0.75f; } if (!(topStormCloudFade < 1f)) { topStormCloudFade = 1f; } if (!(fadeStormClouds < 1f)) { fadeStormClouds = 1f; } if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity -= 0.0015f; if (!(sunShaftScript.sunShaftIntensity > 0.1f)) { sunShaftScript.sunShaftIntensity = 0f; } } if (!(time < 1f)) { time = 1f; } } public virtual void CalculateDays() { sunCalculator = 0f; Hour = 0f; dayCounter++; forceStorm++; hour1 = false; hour2 = false; hour3 = false; hour4 = false; hour5 = false; hour6 = false; hour7 = false; hour8 = false; hour9 = false; hour10 = false; hour11 = false; hour12 = false; hour13 = false; hour14 = false; hour15 = false; hour16 = false; hour17 = false; hour18 = false; hour19 = false; hour20 = false; hour21 = false; hour22 = false; hour23 = false; hour0 = false; if (weatherForecaster == 3 || weatherForecaster == 2 || weatherForecaster == 12) { changeWeather++; } } public virtual void LoadTime() { realStartTimeMinutesFloat = realStartTimeMinutes; startTime = (float)(realStartTime / 24) + realStartTimeMinutesFloat / 1440f; } public virtual void InstantWeather() { if (weatherForecaster == 1) { topStormCloudFade = 1f; fade2 = 0.75f; minRainIntensity = 0f; minSnowIntensity = 0f; minSnowFogIntensity = 0f; minHeavyRainMistIntensity = 0f; minFogIntensity = 0f; rainSoundComponent.volume = 0f; windSoundComponent.volume = 0f; windSnowSoundComponent.volume = 0f; sunShaftFade = 0f; sunIntensity = HeavyRainSunIntensity; RenderSettings.fogEndDistance = stormyFogDistance; RenderSettings.fogStartDistance = stormyFogDistanceStart; butterfliesFade = 0f; windyLeavesFade = 0f; if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity = 0f; } fader2 = 0f; fader = 1f; if (terrainDetection) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = normalGrassWavingSpeed; Terrain.activeTerrain.terrainData.wavingGrassAmount = normalGrassWavingStrength; Terrain.activeTerrain.terrainData.wavingGrassStrength = normalGrassWavingAmount; } } if (weatherForecaster == 2 && temperature > 32) { topStormCloudFade = 1f; fade2 = 0.75f; minRainIntensity = maxLightRainIntensity; minSnowIntensity = 0f; minSnowFogIntensity = 0f; rainSoundComponent.volume = 0.3f; windSoundComponent.volume = 0.3f; windSnowSoundComponent.volume = 0f; sunShaftFade = 0f; sunIntensity = HeavyRainSunIntensity; RenderSettings.fogEndDistance = stormyFogDistance; RenderSettings.fogStartDistance = stormyFogDistanceStart; butterfliesFade = 0f; windyLeavesFade = 0f; if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity = 0f; } fader2 = 0f; fader = 1f; if (terrainDetection) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = normalGrassWavingSpeed; Terrain.activeTerrain.terrainData.wavingGrassAmount = normalGrassWavingStrength; Terrain.activeTerrain.terrainData.wavingGrassStrength = normalGrassWavingAmount; } } if (weatherForecaster == 2 && temperature <= 32) { topStormCloudFade = 1f; fade2 = 0.75f; minRainIntensity = 0f; minFogIntensity = 0f; minSnowIntensity = maxLightSnowIntensity; minSnowFogIntensity = maxLightSnowDustIntensity; rainSoundComponent.volume = 0f; windSoundComponent.volume = 0f; windSnowSoundComponent.volume = 0.3f; sunShaftFade = 0f; sunIntensity = HeavyRainSunIntensity; RenderSettings.fogEndDistance = stormyFogDistance; RenderSettings.fogStartDistance = stormyFogDistanceStart; butterfliesFade = 0f; windyLeavesFade = 0f; if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity = 0f; } fader2 = 0f; fader = 1f; if (terrainDetection) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = normalGrassWavingSpeed; Terrain.activeTerrain.terrainData.wavingGrassAmount = normalGrassWavingStrength; Terrain.activeTerrain.terrainData.wavingGrassStrength = normalGrassWavingAmount; } } if ((weatherForecaster == 3 && temperature > 32) || (weatherForecaster == 12 && temperature > 32)) { topStormCloudFade = 1f; fade2 = 0.75f; currentGeneratedIntensity = 1000; minRainIntensity = 1000f; minSnowIntensity = 0f; minSnowFogIntensity = 0f; minHeavyRainMistIntensity = maxHeavyRainMistIntensity; minFogIntensity = maxStormMistCloudsIntensity; rainSoundComponent.volume = 1f; windSoundComponent.volume = 1f; windSnowSoundComponent.volume = 0f; sunShaftFade = 0f; sunIntensity = HeavyRainSunIntensity; RenderSettings.fogEndDistance = stormyFogDistance; RenderSettings.fogStartDistance = stormyFogDistanceStart; butterfliesFade = 0f; windyLeavesFade = 0f; if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity = 0f; } fader2 = 0f; fader = 1f; if (terrainDetection) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = stormGrassWavingSpeed; Terrain.activeTerrain.terrainData.wavingGrassAmount = stormGrassWavingStrength; Terrain.activeTerrain.terrainData.wavingGrassStrength = stormGrassWavingAmount; } } if ((weatherForecaster == 3 && temperature <= 32) || (weatherForecaster == 12 && temperature <= 32)) { topStormCloudFade = 1f; fade2 = 0.75f; minRainIntensity = 0f; minFogIntensity = 0f; currentGeneratedIntensity = 1000; minSnowIntensity = 1000f; minSnowFogIntensity = 1000f; rainSoundComponent.volume = 0f; windSoundComponent.volume = 0f; windSnowSoundComponent.volume = 1f; sunShaftFade = 0f; sunIntensity = HeavyRainSunIntensity; RenderSettings.fogEndDistance = stormyFogDistance; RenderSettings.fogStartDistance = stormyFogDistanceStart; butterfliesFade = 0f; windyLeavesFade = 0f; if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity = 0f; } fader2 = 0f; fader = 1f; if (terrainDetection) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = stormGrassWavingSpeed; Terrain.activeTerrain.terrainData.wavingGrassAmount = stormGrassWavingStrength; Terrain.activeTerrain.terrainData.wavingGrassStrength = stormGrassWavingAmount; } } if (weatherForecaster == 4) { topStormCloudFade = 0f; fade2 = 0f; minRainIntensity = 0f; minHeavyRainMistIntensity = 0f; minFogIntensity = 0f; minSnowIntensity = 0f; minSnowFogIntensity = 0f; rainSoundComponent.volume = 0f; windSoundComponent.volume = 0f; windSnowSoundComponent.volume = 0f; sunShaftFade = 0f; sunIntensity = maxSunIntensity; RenderSettings.fogEndDistance = fogEndDistance; RenderSettings.fogStartDistance = fogStartDistance; butterfliesFade = 0f; windyLeavesFade = 0f; if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity = 2f; } fader2 = 1f; fader = 0f; partlyCloudyFader = 1f; mostlyCloudyFader = 0f; clearFader = 1f; if (terrainDetection) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = normalGrassWavingSpeed; Terrain.activeTerrain.terrainData.wavingGrassAmount = normalGrassWavingStrength; Terrain.activeTerrain.terrainData.wavingGrassStrength = normalGrassWavingAmount; } } if (weatherForecaster == 7 || weatherForecaster == 8) { topStormCloudFade = 0f; fade2 = 0f; minRainIntensity = 0f; minHeavyRainMistIntensity = 0f; minFogIntensity = 0f; minSnowIntensity = 0f; minSnowFogIntensity = 0f; rainSoundComponent.volume = 0f; windSoundComponent.volume = 0f; windSnowSoundComponent.volume = 0f; sunShaftFade = 0f; sunIntensity = maxSunIntensity; RenderSettings.fogEndDistance = fogEndDistance; RenderSettings.fogStartDistance = fogStartDistance; butterfliesFade = 0f; windyLeavesFade = 0f; if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity = 2f; } fader2 = 1f; fader = 0f; if (weatherForecaster == 7) { partlyCloudyFader = 0f; clearFader = 1f; mostlyCloudyFader = 0f; } if (weatherForecaster == 9) { partlyCloudyFader = 0f; clearFader = 0f; mostlyCloudyFader = 0f; } if (terrainDetection) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = normalGrassWavingSpeed; Terrain.activeTerrain.terrainData.wavingGrassAmount = normalGrassWavingStrength; Terrain.activeTerrain.terrainData.wavingGrassStrength = normalGrassWavingAmount; } } if (weatherForecaster == 11) { topStormCloudFade = 0f; fade2 = 0f; minRainIntensity = 0f; minHeavyRainMistIntensity = 0f; minFogIntensity = 0f; minSnowIntensity = 0f; minSnowFogIntensity = 0f; rainSoundComponent.volume = 0f; windSoundComponent.volume = 0f; windSnowSoundComponent.volume = 0f; sunShaftFade = 0f; sunIntensity = maxSunIntensity; RenderSettings.fogEndDistance = fogEndDistance; RenderSettings.fogStartDistance = fogStartDistance; butterfliesFade = 0f; windyLeavesFade = 0f; if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity = 2f; } fader2 = 1f; fader = 0f; clearFader = 1f; partlyCloudyFader = 1f; mostlyCloudyFader = 1f; if (terrainDetection) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = normalGrassWavingSpeed; Terrain.activeTerrain.terrainData.wavingGrassAmount = normalGrassWavingStrength; Terrain.activeTerrain.terrainData.wavingGrassStrength = normalGrassWavingAmount; } } if (weatherForecaster == 10 && monthCounter >= 5 && monthCounter <= 7) { topStormCloudFade = 0f; fade2 = 0f; minRainIntensity = 0f; minHeavyRainMistIntensity = 0f; minFogIntensity = 0f; minSnowIntensity = 0f; minSnowFogIntensity = 0f; rainSoundComponent.volume = 0f; windSoundComponent.volume = 0f; windSnowSoundComponent.volume = 0f; sunShaftFade = 0f; sunIntensity = maxSunIntensity; RenderSettings.fogEndDistance = fogEndDistance; RenderSettings.fogStartDistance = fogStartDistance; butterfliesFade = 8f; windyLeavesFade = 0f; if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity = 2f; } fader2 = 1f; fader = 0f; partlyCloudyFader = 1f; mostlyCloudyFader = 0f; clearFader = 1f; if (terrainDetection) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = normalGrassWavingSpeed; Terrain.activeTerrain.terrainData.wavingGrassAmount = normalGrassWavingStrength; Terrain.activeTerrain.terrainData.wavingGrassStrength = normalGrassWavingAmount; } } if (weatherForecaster == 13 && monthCounter >= 8 && monthCounter <= 10) { topStormCloudFade = 0f; fade2 = 0f; minRainIntensity = 0f; minHeavyRainMistIntensity = 0f; minFogIntensity = 0f; minSnowIntensity = 0f; minSnowFogIntensity = 0f; rainSoundComponent.volume = 0f; windSoundComponent.volume = 0f; windSnowSoundComponent.volume = 0f; sunShaftFade = 0f; sunIntensity = maxSunIntensity; RenderSettings.fogEndDistance = fogEndDistance; RenderSettings.fogStartDistance = fogStartDistance; butterfliesFade = 0f; windyLeavesFade = 6f; if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity = 2f; } fader2 = 1f; fader = 0f; partlyCloudyFader = 1f; mostlyCloudyFader = 0f; clearFader = 1f; if (terrainDetection) { Terrain.activeTerrain.terrainData.wavingGrassSpeed = normalGrassWavingSpeed; Terrain.activeTerrain.terrainData.wavingGrassAmount = normalGrassWavingStrength; Terrain.activeTerrain.terrainData.wavingGrassStrength = normalGrassWavingAmount; } } } public virtual void TemperatureGeneration() { if (monthCounter >= 2 && monthCounter <= 4) { summerTemp = 0; winterTemp = 0; fallTemp = 0; if (springTemp == 0) { springTemp = 1; } } if (monthCounter >= 5 && monthCounter <= 7) { winterTemp = 0; fallTemp = 0; springTemp = 0; if (summerTemp == 0) { summerTemp = 1; } } if (monthCounter >= 8 && monthCounter <= 10) { summerTemp = 0; winterTemp = 0; springTemp = 0; if (fallTemp == 0) { fallTemp = 1; } } if (monthCounter == 11 || monthCounter == 12 || monthCounter == 1) { summerTemp = 0; fallTemp = 0; springTemp = 0; if (winterTemp == 0) { winterTemp = 1; } } if (monthCounter >= 2 && monthCounter <= 4) { if (springTemp == 1) { temperature = startingSpringTemp; springTemp = 2; } if (temperature <= minSpringTemp && springTemp == 2) { temperature = minSpringTemp; } if (temperature >= maxSpringTemp && springTemp == 2) { temperature = maxSpringTemp; } } if (monthCounter >= 5 && monthCounter <= 7) { if (summerTemp == 1) { temperature = startingSummerTemp; summerTemp = 2; } if (temperature <= minSummerTemp && summerTemp == 2) { temperature = minSummerTemp; } if (temperature >= maxSummerTemp && summerTemp == 2) { temperature = maxSummerTemp; } } if (monthCounter >= 8 && monthCounter <= 10) { if (fallTemp == 1) { temperature = startingFallTemp; fallTemp = 2; } if (temperature <= minFallTemp && fallTemp == 2) { temperature = minFallTemp; } if (temperature >= maxFallTemp && fallTemp == 2) { temperature = maxFallTemp; } } if (monthCounter >= 11 || monthCounter >= 12 || monthCounter <= 1) { if (winterTemp == 1) { temperature = startingWinterTemp; winterTemp = 2; } if (temperature <= minWinterTemp && winterTemp == 2) { temperature = minWinterTemp; } if (temperature >= maxWinterTemp && winterTemp == 2) { temperature = maxWinterTemp; } } } public virtual void MoonPhaseCalculator() { if (moonPhaseCalculator == 1) { moonObjectComponent.sharedMaterial = moonPhase1; } if (moonPhaseCalculator == 2) { moonObjectComponent.sharedMaterial = moonPhase2; } if (moonPhaseCalculator == 3) { moonObjectComponent.sharedMaterial = moonPhase3; } if (moonPhaseCalculator == 4) { moonObjectComponent.sharedMaterial = moonPhase4; } if (moonPhaseCalculator == 5) { moonObjectComponent.sharedMaterial = moonPhase5; } if (moonPhaseCalculator == 6) { moonObjectComponent.sharedMaterial = moonPhase6; } if (moonPhaseCalculator == 7) { moonObjectComponent.sharedMaterial = moonPhase7; } if (moonPhaseCalculator == 8) { moonObjectComponent.sharedMaterial = moonPhase8; } if (moonPhaseCalculator == 9) { moonPhaseCalculator = 1; } } public virtual void Main() { } }