Polished WaveUI

This commit is contained in:
BOT Alex 2024-02-04 08:23:13 +01:00
parent 3d1f783f19
commit a5bb3c6864
2 changed files with 17 additions and 11 deletions

View File

@ -2399,6 +2399,10 @@ PrefabInstance:
propertyPath: spawner propertyPath: spawner
value: value:
objectReference: {fileID: 5796191506433166634} objectReference: {fileID: 5796191506433166634}
- target: {fileID: 1656765803503857110, guid: 48e0e53445d42474895d37a321c39d1c, type: 3}
propertyPath: waveTextDisplayTime
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2404937059918327841, guid: 48e0e53445d42474895d37a321c39d1c, type: 3} - target: {fileID: 2404937059918327841, guid: 48e0e53445d42474895d37a321c39d1c, type: 3}
propertyPath: m_AnchorMax.y propertyPath: m_AnchorMax.y
value: 0 value: 0

View File

@ -31,24 +31,26 @@ public class WaveUI : MonoBehaviour
IEnumerator ShowWave() 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}"; 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); yield return new WaitForSecondsRealtime(waveTextDisplayTime);
color = new Color(1, 1, 1, 1); color = new Color(1, 1, 1, 1);
while (color.a <= 0) while (color.a >= 0)
{ {
waveText.color = color;
color.a -= 0.05f; color.a -= 0.05f;
yield return new WaitForSecondsRealtime(0.1f); waveText.color = color;
yield return new WaitForSecondsRealtime(0.05f);
} }
} }
} }