|
|
|
@ -62,6 +62,13 @@ namespace Fungus
|
|
|
|
|
float startAlpha = Game.GetInstance().fadeAlpha; |
|
|
|
|
float timer = 0; |
|
|
|
|
|
|
|
|
|
// If already at the target alpha then complete immediately |
|
|
|
|
if (startAlpha == targetAlpha) |
|
|
|
|
{ |
|
|
|
|
yield return null; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
while (timer < fadeDuration) |
|
|
|
|
{ |
|
|
|
|
float t = timer / fadeDuration; |
|
|
|
@ -72,6 +79,7 @@ namespace Fungus
|
|
|
|
|
Game.GetInstance().fadeAlpha = Mathf.Lerp(startAlpha, targetAlpha, t); |
|
|
|
|
yield return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Game.GetInstance().fadeAlpha = targetAlpha; |
|
|
|
|
|
|
|
|
|