private void CheckParticleVariables(WeatherMakerFallingParticleScript script) { if (script == null || script.AudioSourceLight == null || script.AudioSourceMedium == null || script.AudioSourceHeavy == null) { Debug.LogErrorFormat("{0} script and/or audio are null", script.gameObject); } }
private void SetVolumeModifier(WeatherMakerFallingParticleScript script, float volumeModifier) { if (script != null) { script.SetVolumeModifier(volumeModifier); } }
private void ChangePrecipitation(WeatherMakerFallingParticleScript newPrecipitation) { if (newPrecipitation != currentPrecipitation && currentPrecipitation != null) { TweenScript(currentPrecipitation, 0.0f); lastPrecipitationIntensityChange = -1.0f; } currentPrecipitation = newPrecipitation; }
private void ChangePrecipitation(WeatherMakerFallingParticleScript newPrecipitation) { if (newPrecipitation != PrecipitationScript && PrecipitationScript != null) { TweenScript(PrecipitationScript, 0.0f); lastPrecipitationIntensityChange = -1.0f; } PrecipitationScript = newPrecipitation; }
private void ChangePrecipitation(WeatherMakerFallingParticleScript newPrecipitation) { if (newPrecipitation != PrecipitationScript && PrecipitationScript != null) { // animate away from the current precipitation TweenPrecipitationScript(PrecipitationScript, 0.0f); lastPrecipitationIntensity = -1.0f; } // set new precipitation script PrecipitationScript = newPrecipitation; }
private void TweenScript(WeatherMakerFallingParticleScript script, float end) { if (Mathf.Abs(script.Intensity - end) < PrecipitationChangeThreshold) { script.Intensity = end; } else { TweenFactory.Tween("WeatherMakerPrecipitationChange_" + script.gameObject.GetInstanceID(), script.Intensity, end, PrecipitationChangeDuration, TweenScaleFunctions.Linear, (t) => { // Debug.LogFormat("Tween key: {0}, value: {1}, prog: {2}", t.Key, t.CurrentValue, t.CurrentProgress); script.Intensity = t.CurrentValue; }, null); } }
private void TweenScript(WeatherMakerFallingParticleScript script, float end) { if (PrecipitationChangeDuration < 0.1f) { script.Intensity = end; return; } float duration = (Mathf.Abs(script.Intensity - end) < PrecipitationChangeThreshold ? 0.0f : PrecipitationChangeDuration); FloatTween tween = TweenFactory.Tween("WeatherMakerPrecipitationChange_" + script.gameObject.GetInstanceID(), script.Intensity, end, duration, TweenScaleFunctions.Linear, (t) => { // Debug.LogFormat("Tween key: {0}, value: {1}, prog: {2}", t.Key, t.CurrentValue, t.CurrentProgress); script.Intensity = t.CurrentValue; }); tween.Delay = PrecipitationChangeDelay; }