protected virtual void Update() { #if DEBUG if (RainFallParticleSystem == null) { Debug.LogError("Rain fall particle system must be set to a particle system"); return; } #endif CheckForRainChange(); UpdateWind(); if (audioSourceRainLight != null) { audioSourceRainLight.Update(); } if (audioSourceRainMedium != null) { audioSourceRainMedium.Update(); } if (audioSourceRainHeavy != null) { audioSourceRainHeavy.Update(); } }
private void UpdateWind() { if (EnableWind && WindZone != null && WindSpeedRange.y > 1.0f) { WindZone.gameObject.SetActive(true); if (FollowCamera) { WindZone.transform.position = Camera.transform.position; } if (!Camera.orthographic) { WindZone.transform.Translate(0.0f, WindZone.radius, 0.0f); } if (nextWindTime < Time.time) { WindZone.windMain = UnityEngine.Random.Range(WindSpeedRange.x, WindSpeedRange.y); WindZone.windTurbulence = UnityEngine.Random.Range(WindSpeedRange.x, WindSpeedRange.y); if (Camera.orthographic) { int val = UnityEngine.Random.Range(0, 2); WindZone.transform.rotation = Quaternion.Euler(0.0f, (val == 0 ? 90.0f : -90.0f), 0.0f); } else { WindZone.transform.rotation = Quaternion.Euler(UnityEngine.Random.Range(-30.0f, 30.0f), UnityEngine.Random.Range(0.0f, 360.0f), 0.0f); } nextWindTime = Time.time + UnityEngine.Random.Range(WindChangeInterval.x, WindChangeInterval.y); if (audioSourceWind != null) { audioSourceWind.Play((WindZone.windMain / WindSpeedRange.z) * WindSoundVolumeModifier); } } } else { if (WindZone != null) { WindZone.gameObject.SetActive(false); } if (audioSourceWind != null) { audioSourceWind.Stop(); } } if (audioSourceWind != null) { audioSourceWind.Update(); } }
private void UpdateWind() { if (EnableWind && WindZone != null && WindSpeedRange.y > 1.0f) { audioSourceWind.Play((WindZone.windMain / WindSpeedRange.z) * WindSoundVolumeModifier); } else { if (WindZone != null) { WindZone.gameObject.SetActive(false); } audioSourceWind.Stop(); } audioSourceWind.Update(); }
protected virtual void Update() { //#if DEBUG // // if (RainFallParticleSystem == null) // { // Debug.LogError("Rain fall particle system must be set to a particle system"); // return; // } // //#endif CheckForRainChange(); UpdateWind(); audioSourceRainLight.Update(); audioSourceRainMedium.Update(); audioSourceRainHeavy.Update(); }
protected virtual void Update() { if (Camera == null) { Camera = Camera.main; Debug.Log("Camera set to main"); } #if DEBUG if (RainFallParticleSystem == null) { Debug.LogError("Rain fall particle system must be set to a particle system"); return; } #endif CheckForRainChange(); UpdateWind(); audioSourceRainLight.Update(); audioSourceRainMedium.Update(); audioSourceRainHeavy.Update(); }