private void TryRain() { if (!this.Raining) { if (this.RainDice >= 2 && this.RainDice <= 6) { this.RainStopRolls = 0; this.State = WeatherSystem.States.GrowingClouds; if (this.RainDice == 2) { this.CloudOvercastTargetValue = UnityEngine.Random.Range(0.55f, 0.7f); this.CloudOpacityScaleTargetValue = UnityEngine.Random.Range(1f, 1.05f); } else if (this.RainDice == 3) { this.CloudOvercastTargetValue = UnityEngine.Random.Range(0.7f, 0.85f); this.CloudOpacityScaleTargetValue = UnityEngine.Random.Range(1.05f, 1.12f); } else if (this.RainDice == 4) { this.CloudOvercastTargetValue = UnityEngine.Random.Range(0.85f, 1f); this.CloudOpacityScaleTargetValue = UnityEngine.Random.Range(1.12f, 1.2f); } else { this.CloudOvercastTargetValue = UnityEngine.Random.Range(0.55f, 1f); this.CloudOpacityScaleTargetValue = UnityEngine.Random.Range(1f, 1.2f); } } } else if (this.RainDiceStop == 2 || this.RainStopRolls >= this.MaxRainDuration) { this.RainStopRolls = 0; if (!this.UsingSnow) { LocalPlayer.MudGreeble.gameObject.SetActive(true); } this.RainDiceStop = 1; this.State = WeatherSystem.States.ReducingClouds; LocalPlayer.Sfx.PlayAfterStorm(); this.CloudOvercastTargetValue = 0f; this.CloudOpacityScaleTargetValue = UnityEngine.Random.Range(0.8f, 1f); this.AllOff(); if (!Clock.Dark) { Scene.Clock.RainbowA.SetActive(true); base.Invoke("RainBowOff", 60f); } this.LastRainTime = Scene.Clock.ElapsedGameTime; } else { this.RainStopRolls++; } }
private void Update() { this.CheckInCave(); if (this.State == WeatherSystem.States.GrowingClouds) { this.CloudOpacityScaleCurrentValue = Mathf.SmoothDamp(this.CloudOpacityScaleCurrentValue, this.CloudOpacityScaleTargetValue * 1.1f, ref this.CloudOpacityScaleVelocity, this.CloudSmoothTime * 3f / 4f); if (this.CloudOpacityScaleCurrentValue < this.CloudOpacityScaleTargetValue) { this.CloudOvercastMat.SetFloat("CloudOpacityScale", this.CloudOpacityScaleCurrentValue); } this.CloudOvercastCurrentValue = Mathf.SmoothDamp(this.CloudOvercastCurrentValue, this.CloudOvercastTargetValue * 1.1f, ref this.CloudOvercastVelocity, this.CloudSmoothTime); if (this.CloudOvercastCurrentValue < this.CloudOvercastTargetValue) { this.CloudOvercastMat.SetFloat("OvercastAmount", this.CloudOvercastCurrentValue); } else { this.CloudOpacityScaleVelocity = 0f; this.CloudOvercastVelocity = 0f; this.CloudOvercastMat.SetFloat("OvercastAmount", this.CloudOvercastTargetValue); this.DoRain(true); } } else if (this.State == WeatherSystem.States.ReducingClouds) { this.CloudOpacityScaleCurrentValue = Mathf.SmoothDamp(this.CloudOpacityScaleCurrentValue, this.CloudOpacityScaleTargetValue * 0.9f, ref this.CloudOpacityScaleVelocity, this.CloudSmoothTime * 3f / 4f); if (this.CloudOpacityScaleCurrentValue > this.CloudOpacityScaleTargetValue) { this.CloudOvercastMat.SetFloat("CloudOpacityScale", this.CloudOpacityScaleCurrentValue); } this.CloudOvercastCurrentValue = Mathf.SmoothDamp(this.CloudOvercastCurrentValue, (this.CloudOvercastTargetValue != 0f) ? (this.CloudOvercastTargetValue * 0.8f) : -0.2f, ref this.CloudOvercastVelocity, this.CloudSmoothTime); if (this.CloudOvercastCurrentValue > this.CloudOvercastTargetValue) { this.CloudOvercastMat.SetFloat("OvercastAmount", this.CloudOvercastCurrentValue); } else { this.CloudOpacityScaleVelocity = 0f; this.CloudOvercastVelocity = 0f; this.CloudOvercastMat.SetFloat("OvercastAmount", this.CloudOvercastTargetValue); this.State = WeatherSystem.States.Idle; } } else { this.CheckSnowArea(); } }
public void TurnOn(WeatherSystem.RainTypes type) { this.CurrentType = type; this.State = WeatherSystem.States.Raining; this.UsingSnow = (LocalPlayer.Stats && LocalPlayer.Stats.IsInNorthColdArea()); Scene.RainFollowGO.SetActive(true); Scene.RainTypes.SnowConstant.SetActive(false); switch (type) { case WeatherSystem.RainTypes.Light: if (this.UsingSnow) { Scene.RainTypes.SnowLight.SetActive(true); } else { Scene.RainTypes.RainLight.SetActive(true); } break; case WeatherSystem.RainTypes.Medium: if (this.UsingSnow) { Scene.RainTypes.SnowMedium.SetActive(true); } else { Scene.RainTypes.RainMedium.SetActive(true); } break; case WeatherSystem.RainTypes.Heavy: if (this.UsingSnow) { Scene.RainTypes.SnowHeavy.SetActive(true); } else { Scene.RainTypes.RainHeavy.SetActive(true); } break; default: this.AllOff(); break; } }
private void DoRain(bool doLighting) { if (BoltNetwork.isClient) { return; } if (this.RainDice == 2) { LocalPlayer.GameObject.SendMessage("GotClean"); LocalPlayer.GameObject.SendMessage("GotCleanReal"); this.TurnOn(WeatherSystem.RainTypes.Light); this.LastRainTime = Scene.Clock.ElapsedGameTime; if (doLighting) { this.Lightning(); } } else if (this.RainDice == 3) { LocalPlayer.GameObject.SendMessage("GotClean"); LocalPlayer.GameObject.SendMessage("GotCleanReal"); this.TurnOn(WeatherSystem.RainTypes.Medium); this.LastRainTime = Scene.Clock.ElapsedGameTime; if (doLighting) { this.Lightning(); } } else if (this.RainDice == 4) { LocalPlayer.GameObject.SendMessage("GotClean"); LocalPlayer.GameObject.SendMessage("GotCleanReal"); this.TurnOn(WeatherSystem.RainTypes.Heavy); this.LastRainTime = Scene.Clock.ElapsedGameTime; if (doLighting) { this.Lightning(); } } else { this.State = WeatherSystem.States.Idle; } }