Tried to finish WaveUI

This commit is contained in:
BOT Alex 2024-02-04 08:04:26 +01:00
parent 2129a89a6a
commit 1c10e953f8
2 changed files with 18 additions and 3 deletions

View File

@ -1359,8 +1359,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 84bc2d619ed39294a84a697578c0d3f6, type: 3} m_Script: {fileID: 11500000, guid: 84bc2d619ed39294a84a697578c0d3f6, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
spawner: {fileID: 0}
slider: {fileID: 6134467867004299163} slider: {fileID: 6134467867004299163}
waveText: {fileID: 5636459425788774448} waveText: {fileID: 5636459425788774448}
waveTextDisplayTime: 3
--- !u!1 &7671763227494701576 --- !u!1 &7671763227494701576
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -13,7 +13,7 @@ public class WaveUI : MonoBehaviour
private void Start() private void Start()
{ {
waveText.gameObject.SetActive(false); waveText.color = new Color(1, 1, 1, 0);
} }
int prevWave = 0; int prevWave = 0;
@ -31,11 +31,24 @@ public class WaveUI : MonoBehaviour
IEnumerator ShowWave() IEnumerator ShowWave()
{ {
waveText.gameObject.SetActive(true); 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}"; waveText.text = $"Wave: {spawner.Wave}";
yield return new WaitForSecondsRealtime(waveTextDisplayTime); yield return new WaitForSecondsRealtime(waveTextDisplayTime);
waveText.gameObject.SetActive(false); color = new Color(1, 1, 1, 1);
while (color.a <= 0)
{
waveText.color = color;
color.a -= 0.05f;
yield return new WaitForSecondsRealtime(0.1f);
}
} }
} }