From a5bb3c686411465c256ecd8f6ba9252170c7a583 Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Sun, 4 Feb 2024 08:23:13 +0100 Subject: [PATCH] Polished WaveUI --- Assets/Scenes/GameScene.unity | 4 ++++ Assets/Scripts/UI/WaveUI.cs | 24 +++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Assets/Scenes/GameScene.unity b/Assets/Scenes/GameScene.unity index ba29552..c5fa899 100644 --- a/Assets/Scenes/GameScene.unity +++ b/Assets/Scenes/GameScene.unity @@ -2399,6 +2399,10 @@ PrefabInstance: propertyPath: spawner value: objectReference: {fileID: 5796191506433166634} + - target: {fileID: 1656765803503857110, guid: 48e0e53445d42474895d37a321c39d1c, type: 3} + propertyPath: waveTextDisplayTime + value: 1 + objectReference: {fileID: 0} - target: {fileID: 2404937059918327841, guid: 48e0e53445d42474895d37a321c39d1c, type: 3} propertyPath: m_AnchorMax.y value: 0 diff --git a/Assets/Scripts/UI/WaveUI.cs b/Assets/Scripts/UI/WaveUI.cs index e12dc6b..ab75809 100644 --- a/Assets/Scripts/UI/WaveUI.cs +++ b/Assets/Scripts/UI/WaveUI.cs @@ -31,24 +31,26 @@ public class WaveUI : MonoBehaviour IEnumerator ShowWave() { - Color color = new Color(1, 1, 1, 0); - while (color.a > 1) - { - waveText.color = color; - color.a += 0.05f; - yield return new WaitForSecondsRealtime(0.1f); - } - waveText.text = $"Wave: {spawner.Wave}"; + + + Color color = new Color(1, 1, 1, 0); + while (color.a < 1) + { + color.a += 0.05f; + waveText.color = color; + yield return new WaitForSecondsRealtime(0.05f); + } + yield return new WaitForSecondsRealtime(waveTextDisplayTime); color = new Color(1, 1, 1, 1); - while (color.a <= 0) + while (color.a >= 0) { - waveText.color = color; color.a -= 0.05f; - yield return new WaitForSecondsRealtime(0.1f); + waveText.color = color; + yield return new WaitForSecondsRealtime(0.05f); } } }