using System.Collections.Generic; using UnityEngine; using UnityStandardAssets.ImageEffects; public class UniStormWeatherSystem_C : MonoBehaviour { [HideInInspector] public GameController gameController; public Color nightTintColor; public int generateDateAndTime = 1; public Color stormCloudColor1; public Color stormCloudColor2; private Renderer starSphereComponent; private Renderer heavyCloudsComponent; public Renderer moonObjectComponent; private Renderer lightClouds1Component; private Renderer lightClouds1aComponent; private Renderer heavyCloudsLayerLightComponent; private Renderer partlyCloudyClouds1Component; private Renderer partlyCloudyClouds2Component; private Renderer mostlyCloudyClouds1Component; private Renderer mostlyCloudyClouds2Component; private Renderer heavyCloudsLayer1Component; private Renderer lightClouds2Component; private Renderer lightClouds3Component; private Renderer lightClouds4Component; private Renderer lightClouds5Component; private Renderer highClouds1Component; private Renderer highClouds2Component; private Renderer mostlyCloudyCloudsComponent; private Light sunComponent; private Light moonComponent; private Light lightSourceComponent; public Transform soundTransform; private AudioSource soundComponent; public AudioSource rainSoundComponent; public AudioSource windSoundComponent; public AudioSource windSnowSoundComponent; public AudioObject rainAudioObject; public AudioObject windAudioObject; public AudioObject windSnowAudioObject; private ParticleEmitter mistFogComponent; public Camera cameraObjectComponent; public bool useInstantStartingWeather; public float sunCalculator; public int environmentType; public float realStartTime; public int realStartTimeMinutes; public float realStartTimeMinutesFloat; public float sunHeight = 0.95f; public float mostlyCloudyFader; public float clearFader; public float colorFader; public float sunPosition = 90f; public Color skyColorMorning; public Color skyColorDay; public Color skyColorEvening; public Color skyColorNight; public string weatherString; public bool menuEnabled; private bool moonChanger; public GameObject menuObject; public float stormyMoonLightIntensity; public bool timeOptions = true; public bool caledarOptions = true; public bool skyOptions = true; public bool atmosphereOptions = true; public bool fogOptions = true; public bool lightningOptions = true; public bool temperatureOptions = true; public bool sunOptions = true; public bool moonOptions = true; public bool precipitationOptions = true; public bool GUIOptions = true; public bool soundManagerOptions = true; public bool colorOptions = true; public bool objectOptions = true; public bool helpOptions = true; public bool WindOptions = true; public bool terrainDetection; 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 int calendarType; public int numberOfDaysInMonth = 31; public int numberOfMonthsInYear = 12; public GameObject partlyCloudyClouds1; public GameObject partlyCloudyClouds2; public GameObject mostlyCloudyClouds1; public GameObject mostlyCloudyClouds2; public float partlyCloudyFader; public int cloudType = 1; public bool UseRainSplashes = true; public bool UseRainMist = true; public ParticleSystem rainSplashes; public ParticleSystem snow; public ParticleSystem snowMistFog; public float sunOffSetX; public float sunOffSetY; public Vector2 sunOffSet = new Vector2(0f, 0f); public float dynamicPartlyCloudyFloat1; public float dynamicPartlyCloudyFloat2; public GameObject dynamicPartlyCloudy1; public GameObject dynamicPartlyCloudy2; public int springTemp; public int summerTemp; public int fallTemp; public int winterTemp; public bool weatherShuffled; public float minHeavyRainMistIntensity; public int maxHeavyRainMistIntensity = 20; public ParticleSystem rainMist; public int moonSize = 4; public float moonRotationY = 4f; public bool customMoonSize; public bool customMoonRotation; public Quaternion moonRotation = Quaternion.identity; public Color cloudColorMorning; public Color cloudColorDay; public Color cloudColorEvening; public Color cloudColorNight; 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 = 1; public int temperature_Celsius = 1; public bool stormControl = true; public int forceWeatherChange; public int randomizedRainIntensity; public int currentGeneratedIntensity; public int lastWeatherType; public bool randomizedPrecipitation; public int moonShadowQuality = 2; public bool useSunFlare; public bool useRainStreaks = true; public Color sunFlareColor; public int timeToWaitMin; public int timeToWaitMax; public int timeToWaitCurrent = 3; 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 = new List(); public List ambientSoundsDay = new List(); public List ambientSoundsEvening = new List(); public List ambientSoundsNight = new List(); public List foldOutList = new List(); public bool shadowsDuringDay = true; public float dayShadowIntensity = 1f; public int dayShadowType = 1; public bool shadowsDuringNight; public float nightShadowIntensity; public int nightShadowType = 1; public bool shadowsLightning; public float lightningShadowIntensity; public int lightningShadowType = 1; public int fogMode = 1; public string version; public int materialIndex; public Vector2 uvAnimationRateA = new Vector2(1f, 0f); public string CloudA = "_MainTex1"; public Vector2 uvAnimationRateB = new Vector2(1f, 0f); public string CloudB = "_MainTex2"; public Vector2 uvAnimationRateC = new Vector2(1f, 0f); public string CloudC = "_MainTex3"; public Vector2 uvAnimationRateHeavyA = new Vector2(1f, 0f); public Vector2 uvAnimationRateHeavyB = new Vector2(1f, 0f); public Vector2 uvAnimationRateHeavyC = new Vector2(1f, 0f); private Vector2 uvOffsetA = Vector2.zero; private Vector2 uvOffsetB = Vector2.zero; private Vector2 uvOffsetC = Vector2.zero; private Vector2 uvOffsetHeavyA = Vector2.zero; private Vector2 uvOffsetHeavyB = Vector2.zero; private Vector2 uvOffsetHeavyC = Vector2.zero; 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 = true; public float moonLightIntensity; public Light moonLight; public Color moonColor; public int minuteCounter; public int minuteCounterNew; public string minute; public int hourCounter; public int hourCounter2; public int dayCounter; public float monthCounter; public float yearCounter; public int morningHourStart = 6; public int dayHourStart = 8; public int eveningHourStart = 16; public int temperature; public float dayLength; public int cloudSpeed; public int heavyCloudSpeed; public int starSpeed; public float starSpeedCalculator; public float starRotationSpeed; public bool timeStopped; public bool staticWeather; public bool timeScrollBar; public bool horizonToggle = true; public bool dynamicSnowEnabled = true; public bool weatherCommandPromptUseable; public bool timeScrollBarUseable; public float startTime; public int startTimeNumber; public float moonPhaseChangeTime; public int weatherForecaster; private string stringToEdit = "0"; public float pressure; public float windSpeed; public float SnowAmount; public float sunIntensity; public float maxSunIntensity; public float sunAngle; public float sunRotationOffset; public Color MorningAmbientLight; public Color MiddayAmbientLight; public Color DuskAmbientLight; public Color TwilightAmbientLight; public Color NightAmbientLight; 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 MorningAtmosphericLight; public Color MiddayAtmosphericLight; public Color DuskAtmosphericLight; public GameObject starSphere; public Color starBrightness; public GameObject moonObject; public int moonPhaseCalculator; 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 Material moonPhase9; 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 int maxLightRainIntensity = 400; public int maxLightRainMistCloudsIntensity = 4; public int maxStormRainIntensity = 1000; public int maxStormMistCloudsIntensity = 15; public int maxLightSnowIntensity = 400; public int maxLightSnowDustIntensity = 4; public int maxSnowStormIntensity = 1000; public int maxHeavySnowDustIntensity = 15; public ParticleSystem rain; public ParticleSystem butterflies; public GameObject mistFog; public ParticleSystem windyLeaves; public WindZone windZoneNormal; 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 float random; public float random2; private float fadeHorizonController; private float stormClouds; private float topStormCloudFade; private float fade2; private float butterfliesFade; private float windyLeavesFade; private float fadeStormClouds; private float fadeStars; private float time; private float sunShaftFade; private float windControl; private float windControlUp; private float dynamicSnowFade; private bool overrideFog; public float stormCounter; private float forceStorm; private float changeWeather; private string foggy = "01"; private string lightRain_lightSnow = "02"; private string rainStorm_snowStorm = "03"; private string partlyCloudy1 = "04"; private string partlyCloudy2 = "05"; private string partlyCloudy3 = "06"; private string clear1 = "07"; private string clear2 = "08"; private string cloudy = "09"; private string mostlyCloudy = "001"; private string heavyRain = "002"; private string fallLeaves = "003"; private string butterfliesSummer = "004"; private bool commandPromptActive; public float minRainIntensity; private float minFogIntensity; public float minSnowIntensity; public float minSnowFogIntensity; private float calculate2; public float Hour; public float minuteCounterCalculator; private float cloudSpeedY; private float cloudSpeedHighY; public SunShafts sunShaftScript; public Color globalFogColor; 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 nightTime; public int stormyFogDistance; public int stormyFogDistanceStart; public int fogStartDistance; public int fogEndDistance; public Transform lightningSpawn; public int lightningNumber; public GameObject lightningBolt1; public bool fadeLightning; public bool lightingGenerated; public Light lightSource; public AudioClip thunderSound1; public AudioClip thunderSound2; public AudioClip thunderSound3; public AudioClip thunderSound4; public AudioClip thunderSound5; 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; private float timer; public float onTimer; public float lightningOdds; public float lightningFlashLength; public int lightningMinChance = 5; public int lightningMaxChance = 10; public float minIntensity; public float maxIntensity; public float lightningIntensity; public Color MorningGradientLight; public Color DayGradientLight; public Color DuskGradientLight; public Color NightGradientLight; public Color MorningGradientContrastLight; public Color DayGradientContrastLight; public Color DuskGradientContrastLight; public Color NightGradientContrastLight; public bool isFalse; public float timerNew; 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; public float sunSize = 0.2f; public Color skyTintColor; public Color groundColor; public float atmosphereThickness; public float exposure; public string variableAsString; [HideInInspector] public bool isInitialized; private void Awake() { if (useCustomPrecipitationSounds) { rainSound.GetComponent().clip = customRainSound; rainSound.GetComponent().enabled = false; windSound.GetComponent().clip = customRainWindSound; windSound.GetComponent().enabled = false; windSnowSound.GetComponent().clip = customSnowWindSound; windSnowSound.GetComponent().enabled = false; } } private void Start() { if (GameController.Instance == null) { Initialize(); } } public void Initialize() { if (useCustomPrecipitationSounds) { Debug.Log("rain " + rainSound.GetComponent().clip.name); rainAudioObject = AudioController.Play(rainSound.GetComponent().clip.name, rainSound.transform); rainAudioObject.volumeItem = 0f; windAudioObject = AudioController.Play(windSound.GetComponent().clip.name, windSound.transform); windSnowAudioObject = AudioController.Play(windSnowSound.GetComponent().clip.name, windSnowSound.transform); } 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; startTime = realStartTime / 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"); if ((bool)sunObject) { 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 = moon.GetComponent(); moonLight.intensity = moonLightIntensity; MoonPhaseCalculator(); if (useInstantStartingWeather) { TemperatureGeneration(); InstantWeather(); } isInitialized = true; } private void GetAllComponents() { heavyCloudsLayer1Component = heavyCloudsLayer1.GetComponent(); lightClouds2Component = lightClouds2.GetComponent(); lightClouds3Component = lightClouds3.GetComponent(); lightClouds4Component = lightClouds4.GetComponent(); lightClouds5Component = lightClouds5.GetComponent(); highClouds1Component = highClouds1.GetComponent(); highClouds2Component = highClouds2.GetComponent(); mostlyCloudyCloudsComponent = mostlyCloudyClouds.GetComponent(); heavyCloudsComponent = heavyClouds.GetComponent(); starSphereComponent = starSphere.GetComponent(); lightClouds1Component = lightClouds1.GetComponent(); lightClouds1aComponent = lightClouds1a.GetComponent(); heavyCloudsLayerLightComponent = heavyCloudsLayerLight.GetComponent(); partlyCloudyClouds1Component = partlyCloudyClouds1.GetComponent(); partlyCloudyClouds2Component = partlyCloudyClouds2.GetComponent(); mostlyCloudyClouds1Component = mostlyCloudyClouds1.GetComponent(); mostlyCloudyClouds2Component = mostlyCloudyClouds2.GetComponent(); moonObjectComponent = moonObject.GetComponent(); sunComponent = sun.GetComponent(); lightSourceComponent = lightSource.GetComponent(); moonComponent = moon.GetComponent(); soundComponent = GetComponent(); rainSoundComponent = rainSound.GetComponent(); windSoundComponent = windSound.GetComponent(); windSnowSoundComponent = windSnowSound.GetComponent(); mistFogComponent = mistFog.GetComponent(); cameraObjectComponent = cameraObject.GetComponent(); sunShaftScript = cameraObjectComponent.GetComponent(); if (sunShaftScript == null) { Debug.LogError("Please apply a C# Sun Shaft Script to your camera GameObject."); } } private void Update() { if (!isInitialized) { return; } SkyBoxMaterial.SetFloat("_AtmosphereThickness", atmosphereThickness); SkyBoxMaterial.SetFloat("_Exposure", exposure); 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 = Random.Range(80, 100); } if (weatherChanceSpring == 60) { weatherOdds = Random.Range(60, 100); } if (weatherChanceSpring == 40) { weatherOdds = Random.Range(40, 100); } if (weatherChanceSpring == 20) { weatherOdds = Random.Range(20, 100); } } if (weatherUpdate == 1 && isSummer) { if (weatherChanceSummer == 80) { weatherOdds = Random.Range(80, 100); } if (weatherChanceSummer == 60) { weatherOdds = Random.Range(60, 100); } if (weatherChanceSummer == 40) { weatherOdds = Random.Range(40, 100); } if (weatherChanceSummer == 20) { weatherOdds = Random.Range(20, 100); } } if (weatherUpdate == 1 && isFall) { if (weatherChanceFall == 80) { weatherOdds = Random.Range(80, 100); } if (weatherChanceFall == 60) { weatherOdds = Random.Range(60, 100); } if (weatherChanceFall == 40) { weatherOdds = Random.Range(40, 100); } if (weatherChanceFall == 20) { weatherOdds = Random.Range(20, 100); } } if (weatherUpdate == 1 && isWinter) { if (weatherChanceWinter == 80) { weatherOdds = Random.Range(80, 100); } if (weatherChanceWinter == 60) { weatherOdds = Random.Range(60, 100); } if (weatherChanceWinter == 40) { weatherOdds = Random.Range(40, 100); } if (weatherChanceWinter == 20) { weatherOdds = Random.Range(20, 100); } } } hourCounter = (int)Hour; stormCounter += Time.deltaTime * 0.5f; minuteCounterCalculator = Hour * 60f; minuteCounter = (int)minuteCounterCalculator; minuteCounterNew = minuteCounter; float num = (float)cloudSpeed * 0.001f; float num2 = (float)heavyCloudSpeed * 0.001f; starSpeedCalculator += (float)starSpeed * 0.1f; cloudSpeedY = 0.003f; float num3 = (float)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 >= 2f && monthCounter <= 4f) { isSpring = true; isSummer = false; isFall = false; isWinter = false; WeatherForecaster(); } if (monthCounter >= 5f && monthCounter <= 7f) { isSummer = true; isSpring = false; isFall = false; isWinter = false; WeatherForecaster(); } if (monthCounter >= 8f && monthCounter <= 10f) { isSummer = false; isSpring = false; isFall = true; isWinter = false; WeatherForecaster(); } if (monthCounter == 11f || monthCounter == 12f || monthCounter == 1f) { isSummer = false; isSpring = false; isFall = false; isWinter = true; WeatherForecaster(); } if (!weatherCommandPromptUseable) { commandPromptActive = false; } TemperatureGeneration(); if (monthCounter == -1f) { monthCounter = 11f; } if (Hour >= 17f) { moonComponent.enabled = true; } if (Hour >= 0f && Hour < 6f) { moonComponent.enabled = true; } if (Hour > 6f && Hour < 17f) { moonComponent.enabled = false; } MoonPhaseCalculator(); sun.transform.localEulerAngles = new Vector3(startTime * 360f - 90f, sunAngle, 180f); if (hourCounter == 1 && !hour1) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour1 = true; } if (hourCounter == 2 && !hour2) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour2 = true; } if (hourCounter == 3 && !hour3) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour3 = true; } if (hourCounter == 4 && !hour4) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour4 = true; } if (hourCounter == 5 && !hour5) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour5 = true; } if (hourCounter == 6 && !hour6) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature += Random.Range(1, 3); hour6 = true; } if (hourCounter == 7 && !hour7) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature += Random.Range(1, 3); hour7 = true; } if (hourCounter == 8 && !hour8) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature += Random.Range(1, 3); hour8 = true; } if (hourCounter == 9 && !hour9) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature += Random.Range(1, 3); hour9 = true; } if (hourCounter == 10 && !hour10) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature += Random.Range(1, 3); hour10 = true; } if (hourCounter == 11 && !hour11) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature += Random.Range(1, 3); hour11 = true; } if (hourCounter == 12 && !hour12) { if ((bool)gameController) { gameController.RenderAllProbes(); } hour12 = true; } if (hourCounter == 13 && !hour13) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature += Random.Range(1, 3); hour13 = true; } if (hourCounter == 14 && !hour14) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature += Random.Range(1, 3); hour14 = true; } if (hourCounter == 15 && !hour15) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature += Random.Range(1, 3); hour15 = true; } if (hourCounter == 16 && !hour16) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature += Random.Range(1, 3); hour16 = true; } if (hourCounter == 17 && !hour17) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour17 = true; } if (hourCounter == 18 && !hour18) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour18 = true; } if (hourCounter == 19 && !hour19) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour19 = true; } if (hourCounter == 20 && !hour20) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour20 = true; } if (hourCounter == 21 && !hour21) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour21 = true; } if (hourCounter == 22 && !hour22) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour22 = true; } if (hourCounter == 23 && !hour23) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour23 = true; } if (hourCounter == 24 && !hour0) { if ((bool)gameController) { gameController.RenderAllProbes(); } temperature -= Random.Range(1, 3); hour0 = true; } if (Hour >= 12f && !moonChanger) { moonPhaseCalculator++; moonChanger = true; } if (Hour <= 1f) { moonChanger = false; } if (minuteCounter >= 60) { minuteCounter = (int)minuteCounterCalculator % 60; } if (minuteCounter == 59) { weatherUpdate++; } if (minuteCounter == 1) { weatherUpdate = 0; } if (!staticWeather) { if (((weatherOdds == 20 && weatherChanceSpring == 20) || (weatherOdds == 20 && weatherChanceSummer == 20) || (weatherOdds == 20 && weatherChanceFall == 20) || (weatherOdds == 20 && weatherChanceWinter == 20)) && stormCounter >= 13f) { weatherForecaster = Random.Range(1, 13); weatherOdds = 1; stormCounter = Random.Range(0, 7); } if (((weatherOdds == 40 && weatherChanceSpring == 40 && weatherOdds == 40 && weatherChanceSummer == 40) || (weatherOdds == 40 && weatherChanceFall == 40) || (weatherOdds == 40 && weatherChanceWinter == 40)) && stormCounter >= 13f) { weatherForecaster = Random.Range(1, 13); weatherOdds = 1; stormCounter = Random.Range(0, 7); } if (((weatherOdds == 60 && weatherChanceSpring == 60 && weatherOdds == 60 && weatherChanceSummer == 60) || (weatherOdds == 60 && weatherChanceFall == 60) || (weatherOdds == 60 && weatherChanceWinter == 60)) && stormCounter >= 13f) { weatherForecaster = Random.Range(1, 13); weatherOdds = 1; stormCounter = Random.Range(0, 7); } if (((weatherOdds == 80 && weatherChanceSpring == 80 && weatherOdds == 80 && weatherChanceSummer == 80) || (weatherOdds == 80 && weatherChanceFall == 80) || (weatherOdds == 80 && weatherChanceWinter == 80)) && stormCounter >= 13f) { weatherForecaster = Random.Range(1, 13); weatherOdds = 1; stormCounter = 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 ((double)sunIntensity >= 0.01) { sun.enabled = true; } if (sunIntensity >= maxSunIntensity) { sunIntensity = maxSunIntensity; lightSourceComponent.enabled = false; } sunCalculator = Hour / 24f; if ((double)sunCalculator < 0.5) { calculate2 = sunCalculator; } if ((double)sunCalculator > 0.5) { calculate2 = 1f - sunCalculator; } if (startTime >= 1f) { startTime = 0f; CalculateDays(); } if (forceStorm >= 7f && !staticWeather) { weatherForecaster = Random.Range(2, 3); forceStorm = 0f; } if (changeWeather >= (float)forceWeatherChange && stormControl && !staticWeather) { weatherForecaster = Random.Range(4, 11); changeWeather = 0f; } 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(); } private 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 < (float)morningHourStart) { 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)); SetCloudsFogColor(Color.Lerp(fogNightColor, fogMorningColor, 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)); float value = Mathf.Lerp(0.5f, 0f, Hour / 2f - 2f); moonObjectComponent.sharedMaterial.SetFloat("_MoonFade", value); 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 >= (float)morningHourStart && Hour < (float)dayHourStart) { 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)); SetCloudsFogColor(Color.Lerp(fogMorningColor, cloudColorDay, 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 >= (float)dayHourStart && Hour < (float)eveningHourStart) { 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)); SetCloudsFogColor(Color.Lerp(cloudColorDay, cloudColorDay, 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 >= (float)eveningHourStart && 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)); SetCloudsFogColor(Color.Lerp(cloudColorDay, fogDuskColor, 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)); SetCloudsFogColor(Color.Lerp(fogDuskColor, fogNightColor, 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)); float value2 = Mathf.Lerp(0f, 0.5f, Hour / 2f - 9f); moonObjectComponent.sharedMaterial.SetFloat("_MoonFade", value2); 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); SetCloudsFogColor(Color.Lerp(fogNightColor, fogNightColor, Hour / 2f - 10f)); 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) { SetCloudsFogColor(fogNightColor); 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); SetCloudsFogColor(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; } } private 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"; } } private 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(); } } } private 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)"); } } private void Lightning() { timer += Time.deltaTime; if (timer >= lightningOdds && !lightingGenerated) { lightingGenerated = true; lightSourceComponent.enabled = true; lightningNumber = Random.Range(1, 5); if (lightningNumber == 1) { AudioController.Play(thunderSound1.name, soundTransform); } if (lightningNumber == 2) { AudioController.Play(thunderSound2.name, soundTransform); } if (lightningNumber == 3) { AudioController.Play(thunderSound3.name, soundTransform); } if (lightningNumber == 4) { AudioController.Play(thunderSound4.name, soundTransform); } if (lightningNumber == 5) { AudioController.Play(thunderSound5.name, soundTransform); } 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, Random.Range(0, 360), 0f); lightningOdds = Random.Range(lightningMinChance, lightningMaxChance); lightningIntensity = Random.Range(minIntensity, maxIntensity); } } } private 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."); } } private 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); } } private void DynamicTimeOfDaySounds() { TODSoundsTimer += Time.deltaTime; if (TODSoundsTimer >= (float)timeToWaitCurrent && Hour > 4f && Hour < 8f && !playedSound && useMorningSounds && !gameController.iceLevel) { if ((bool)soundTransform) { AudioController.Play(ambientSoundsMorning[Random.Range(0, ambientSoundsMorning.Count)].name, soundTransform); } playedSound = true; } if (TODSoundsTimer > (float)timeToWaitCurrent && Hour > 8f && Hour < 16f && !playedSound && useDaySounds && !gameController.iceLevel) { if ((bool)soundTransform) { AudioController.Play(ambientSoundsDay[Random.Range(0, ambientSoundsDay.Count)].name, soundTransform); } playedSound = true; } if (TODSoundsTimer > (float)timeToWaitCurrent && Hour > 16f && Hour < 20f && !playedSound && useEveningSounds && !gameController.iceLevel) { if ((bool)soundTransform) { AudioController.Play(ambientSoundsEvening[Random.Range(0, ambientSoundsEvening.Count)].name, soundTransform); } playedSound = true; } if (TODSoundsTimer > (float)timeToWaitCurrent && Hour > 20f && Hour < 25f && !playedSound && useNightSounds && !gameController.iceLevel) { if ((bool)soundTransform && ambientSoundsNight[0] != null) { AudioController.Play(ambientSoundsNight[Random.Range(0, ambientSoundsNight.Count)].name, soundTransform); } playedSound = true; } if (TODSoundsTimer > (float)timeToWaitCurrent && Hour > 0f && Hour < 4f && !playedSound && useNightSounds && !gameController.iceLevel) { if ((bool)soundTransform && ambientSoundsNight[0] != null) { AudioController.Play(ambientSoundsNight[Random.Range(0, ambientSoundsNight.Count)].name, soundTransform); } playedSound = true; } if (TODSoundsTimer >= (float)(timeToWaitCurrent + 2)) { timeToWaitCurrent = Random.Range(timeToWaitMin, timeToWaitMax); TODSoundsTimer = 0f; playedSound = false; } } private 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; moonLight.intensity += 0.001f; if (moonLight.intensity >= moonLightIntensity) { moonLight.intensity = moonLightIntensity; } if (weatherForecaster == 13 && monthCounter >= 8f && monthCounter <= 10f) { windyLeavesFade += 0.04f; if (windyLeavesFade >= 6f) { windyLeavesFade = 6f; } } else { windyLeavesFade -= 0.04f; if (windyLeavesFade <= 0f) { windyLeavesFade = 0f; } } if (weatherForecaster == 10 && monthCounter >= 5f && monthCounter <= 7f) { butterfliesFade += 0.04f; if (butterfliesFade >= 8f) { butterfliesFade = 8f; } } else { butterfliesFade -= 0.04f; if (butterfliesFade <= 0f) { butterfliesFade = 0f; } } if (terrainDetection) { Terrain.activeTerrain.terrainData.wavingGrassSpeed -= 0.00025f; Terrain.activeTerrain.terrainData.wavingGrassAmount -= 0.00025f; 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 ((double)dynamicSnowFade <= 0.25) { 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; rainAudioObject.volumeItem -= Time.deltaTime * 0.07f; windAudioObject.volumeItem -= Time.deltaTime * 0.04f; windSnowAudioObject.volumeItem -= 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; } } } private 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; rainAudioObject.volumeItem -= Time.deltaTime * 0.07f; windAudioObject.volumeItem -= Time.deltaTime * 0.04f; windSnowAudioObject.volumeItem -= 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; rainAudioObject.volumeItem += Time.deltaTime * 0.01f; if (fade2 >= 0.3f) { minRainIntensity += 0.2f; } minFogIntensity -= 0.008f; if (minRainIntensity >= (float)maxLightRainIntensity) { minRainIntensity = maxLightRainIntensity; } if (minFogIntensity <= 0f) { minFogIntensity = 0f; } if (minHeavyRainMistIntensity <= 0f) { minHeavyRainMistIntensity = 0f; } if ((double)windSoundComponent.volume >= 0.0) { windSoundComponent.volume = 0f; } if (windAudioObject.volumeItem >= 0f) { windAudioObject.volumeItem = 0f; } if ((double)rainSoundComponent.volume >= 0.3) { rainSoundComponent.volume = 0.3f; } if (rainAudioObject.volumeItem >= 0.3f) { rainAudioObject.volumeItem = 0.3f; } if (lastWeatherType != weatherForecaster && randomizedPrecipitation) { randomizedRainIntensity = Random.Range(100, maxLightRainIntensity); currentGeneratedIntensity = randomizedRainIntensity; lastWeatherType = weatherForecaster; } if (!randomizedPrecipitation && minRainIntensity >= (float)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 >= (float)maxStormRainIntensity) { minRainIntensity = maxStormRainIntensity; } if (randomizedPrecipitation && minRainIntensity >= (float)currentGeneratedIntensity) { minRainIntensity = currentGeneratedIntensity; } if (lastWeatherType != weatherForecaster && randomizedPrecipitation) { randomizedRainIntensity = Random.Range(400, maxStormRainIntensity); currentGeneratedIntensity = randomizedRainIntensity; lastWeatherType = weatherForecaster; } if (minRainIntensity >= (float)maxStormRainIntensity) { minRainIntensity = maxStormRainIntensity; } if (minFogIntensity >= (float)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; rainAudioObject.volumeItem -= Time.deltaTime * 0.04f; windAudioObject.volumeItem -= Time.deltaTime * 0.04f; if (lastWeatherType != weatherForecaster && randomizedPrecipitation) { randomizedRainIntensity = Random.Range(100, maxSnowStormIntensity); currentGeneratedIntensity = randomizedRainIntensity; lastWeatherType = weatherForecaster; } if (!randomizedPrecipitation && minSnowIntensity >= (float)maxSnowStormIntensity) { minSnowIntensity = maxSnowStormIntensity; } if (randomizedPrecipitation && minSnowIntensity >= (float)currentGeneratedIntensity) { minSnowIntensity = currentGeneratedIntensity; } if (minSnowIntensity >= (float)maxSnowStormIntensity) { minSnowIntensity = maxSnowStormIntensity; } if (minSnowFogIntensity >= (float)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; windSnowAudioObject.volumeItem += Time.deltaTime * 0.01f; windAudioObject.volumeItem -= Time.deltaTime * 0.04f; rainAudioObject.volumeItem -= Time.deltaTime * 0.04f; if (lastWeatherType != weatherForecaster && randomizedPrecipitation) { randomizedRainIntensity = Random.Range(100, maxLightSnowIntensity); currentGeneratedIntensity = randomizedRainIntensity; lastWeatherType = weatherForecaster; } if (!randomizedPrecipitation && minSnowIntensity >= (float)maxLightSnowIntensity) { minSnowIntensity = maxLightSnowIntensity; } if (randomizedPrecipitation && minSnowIntensity >= (float)currentGeneratedIntensity) { minSnowIntensity = currentGeneratedIntensity; } if (minSnowIntensity >= (float)maxLightSnowIntensity) { minSnowIntensity = maxLightSnowIntensity; } if (minSnowFogIntensity >= (float)maxLightSnowDustIntensity) { minSnowFogIntensity = maxLightSnowDustIntensity; } if (minRainIntensity <= 0f) { minRainIntensity = 0f; } if (minFogIntensity <= 0f) { minFogIntensity = 0f; } if (minHeavyRainMistIntensity <= 0f) { minHeavyRainMistIntensity = 0f; } if ((double)windSnowSoundComponent.volume >= 0.3) { windSnowSoundComponent.volume = 0.3f; } if ((double)windSnowAudioObject.volumeItem >= 0.3) { windSnowAudioObject.volumeItem = 0.3f; } } if (terrainDetection) { if (weatherForecaster == 3 || weatherForecaster == 12) { Terrain.activeTerrain.terrainData.wavingGrassSpeed += 8E-05f; Terrain.activeTerrain.terrainData.wavingGrassAmount += 8E-05f; 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 -= 0.00025f; Terrain.activeTerrain.terrainData.wavingGrassAmount -= 0.00025f; 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 ((double)dynamicSnowFade <= 0.25) { dynamicSnowFade = 0.25f; } if ((double)fade2 >= 0.75) { 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 ((double)RenderSettings.fogDensity <= 0.0006) { RenderSettings.fogDensity = 0.0006f; if (overrideFog) { } } if (overrideFog) { } if ((double)stormClouds >= 0.55) { stormClouds = 0.55f; } if ((double)fade2 >= 0.75) { fade2 = 0.75f; } if (topStormCloudFade >= 1f) { topStormCloudFade = 1f; } if (fadeStormClouds >= 1f) { fadeStormClouds = 1f; } if (sunShaftScript != null) { sunShaftScript.sunShaftIntensity -= 0.0015f; if ((double)sunShaftScript.sunShaftIntensity <= 0.1) { sunShaftScript.sunShaftIntensity = 0f; } } if (time >= 1f) { time = 1f; } } public void CalculateDays() { sunCalculator = 0f; Hour = 0f; 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) { } } public void LoadTime() { realStartTimeMinutesFloat = realStartTimeMinutes; startTime = realStartTime / 24f + realStartTimeMinutesFloat / 1440f; } public 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; rainAudioObject.volumeItem = 0f; windAudioObject.volumeItem = 0f; windSnowAudioObject.volumeItem = 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; rainAudioObject.volumeItem = 0.3f; windAudioObject.volumeItem = 0.3f; windSnowAudioObject.volumeItem = 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; rainAudioObject.volumeItem = 0f; windAudioObject.volumeItem = 0f; windSnowAudioObject.volumeItem = 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 = maxStormRainIntensity; minSnowIntensity = 0f; minSnowFogIntensity = 0f; minHeavyRainMistIntensity = maxHeavyRainMistIntensity; minFogIntensity = maxStormMistCloudsIntensity; rainSoundComponent.volume = 1f; windSoundComponent.volume = 1f; windSnowSoundComponent.volume = 0f; rainAudioObject.volumeItem = 0.5f; windAudioObject.volumeItem = 0.5f; windSnowAudioObject.volumeItem = 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 = maxSnowStormIntensity; minSnowFogIntensity = 1000f; rainSoundComponent.volume = 0f; windSoundComponent.volume = 0f; windSnowSoundComponent.volume = 1f; rainAudioObject.volumeItem = 0f; windAudioObject.volumeItem = 0f; windSnowAudioObject.volumeItem = 0f; sunShaftFade = 0f; sunIntensity = maxSunIntensity; 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; rainAudioObject.volumeItem = 0f; windAudioObject.volumeItem = 0f; windSnowAudioObject.volumeItem = 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; rainAudioObject.volumeItem = 0f; windAudioObject.volumeItem = 0f; windSnowAudioObject.volumeItem = 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; rainAudioObject.volumeItem = 0f; windAudioObject.volumeItem = 0f; windSnowAudioObject.volumeItem = 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 >= 5f && monthCounter <= 7f) { topStormCloudFade = 0f; fade2 = 0f; minRainIntensity = 0f; minHeavyRainMistIntensity = 0f; minFogIntensity = 0f; minSnowIntensity = 0f; minSnowFogIntensity = 0f; rainSoundComponent.volume = 0f; windSoundComponent.volume = 0f; windSnowSoundComponent.volume = 0f; rainAudioObject.volumeItem = 0f; windAudioObject.volumeItem = 0f; windSnowAudioObject.volumeItem = 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 >= 8f && monthCounter <= 10f) { topStormCloudFade = 0f; fade2 = 0f; minRainIntensity = 0f; minHeavyRainMistIntensity = 0f; minFogIntensity = 0f; minSnowIntensity = 0f; minSnowFogIntensity = 0f; rainSoundComponent.volume = 0f; windSoundComponent.volume = 0f; windSnowSoundComponent.volume = 0f; rainAudioObject.volumeItem = 0f; windAudioObject.volumeItem = 0f; windSnowAudioObject.volumeItem = 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; } } } private void TemperatureGeneration() { if (monthCounter >= 2f && monthCounter <= 4f) { summerTemp = 0; winterTemp = 0; fallTemp = 0; if (springTemp == 0) { springTemp = 1; } } if (monthCounter >= 5f && monthCounter <= 7f) { winterTemp = 0; fallTemp = 0; springTemp = 0; if (summerTemp == 0) { summerTemp = 1; } } if (monthCounter >= 8f && monthCounter <= 10f) { summerTemp = 0; winterTemp = 0; springTemp = 0; if (fallTemp == 0) { fallTemp = 1; } } if (monthCounter == 11f || monthCounter == 12f || monthCounter == 1f) { summerTemp = 0; fallTemp = 0; springTemp = 0; if (winterTemp == 0) { winterTemp = 1; } } if (monthCounter >= 2f && monthCounter <= 4f) { if (springTemp == 1) { temperature = startingSpringTemp; springTemp = 2; } if (temperature <= minSpringTemp && springTemp == 2) { temperature = minSpringTemp; } if (temperature >= maxSpringTemp && springTemp == 2) { temperature = maxSpringTemp; } } if (monthCounter >= 5f && monthCounter <= 7f) { if (summerTemp == 1) { temperature = startingSummerTemp; summerTemp = 2; } if (temperature <= minSummerTemp && summerTemp == 2) { temperature = minSummerTemp; } if (temperature >= maxSummerTemp && summerTemp == 2) { temperature = maxSummerTemp; } } if (monthCounter >= 8f && monthCounter <= 10f) { if (fallTemp == 1) { temperature = startingFallTemp; fallTemp = 2; } if (temperature <= minFallTemp && fallTemp == 2) { temperature = minFallTemp; } if (temperature >= maxFallTemp && fallTemp == 2) { temperature = maxFallTemp; } } if (monthCounter >= 11f || monthCounter >= 12f || monthCounter <= 1f) { if (winterTemp == 1) { temperature = startingWinterTemp; winterTemp = 2; } if (temperature <= minWinterTemp && winterTemp == 2) { temperature = minWinterTemp; } if (temperature >= maxWinterTemp && winterTemp == 2) { temperature = maxWinterTemp; } } } private 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 void SetCloudsFogColor(Color fogColor) { lightClouds1Component.material.SetColor("_FogColor", fogColor); lightClouds1aComponent.material.SetColor("_FogColor", fogColor); partlyCloudyClouds1Component.material.SetColor("_FogColor", fogColor); partlyCloudyClouds2Component.material.SetColor("_FogColor", fogColor); mostlyCloudyClouds1Component.material.SetColor("_FogColor", fogColor); mostlyCloudyClouds2Component.material.SetColor("_FogColor", fogColor); } }