From 882873cb5bc3accf77e91c21417d1e0af7e8d074 Mon Sep 17 00:00:00 2001 From: orels1 Date: Sun, 6 Sep 2020 04:57:04 +0300 Subject: [PATCH] Improved lerping behaviour on the FogAdjustment.cs --- Misc/FogAdjustment.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Misc/FogAdjustment.cs b/Misc/FogAdjustment.cs index 1c3843f..7ea3027 100644 --- a/Misc/FogAdjustment.cs +++ b/Misc/FogAdjustment.cs @@ -71,6 +71,9 @@ void Start() { } private void StartLerping() { + if (lerping) { + active = !active; + } lerping = true; lerpEnd = Time.time + fogTransitionTime; fromColor = RenderSettings.fogColor; @@ -166,7 +169,6 @@ private void Update() { var alpha = (Time.time - (lerpEnd - fogTransitionTime)) / fogTransitionTime; // if currently active - lerp down; if (active) { - Debug.Log("lerping down"); if (mode == FogMode.Linear) { LerpFogLinear(fromColor, defaultFogColor, fromStart, defaultFogStart, fromEnd, defaultFogEnd, alpha); @@ -176,7 +178,6 @@ private void Update() { } } // otherwise - lerp up; else { - Debug.Log("lerping up"); if (mode == FogMode.Linear) { LerpFogLinear(fromColor, activeFogColor, fromStart, activeFogStart, fromEnd, activeFogEnd, alpha); @@ -187,7 +188,6 @@ private void Update() { } if (!(Time.time > lerpEnd)) return; - Debug.LogFormat("Reached lerp end, resetting {0}, current {1}", lerpEnd, Time.time); lerping = false; active = !active; }