blob: cf4b150f7387a25ced7a189eb8afb82184cc839a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
using System.Collections;
using TMPro;
using UnityEngine;
public class WaveCountPopUp : MonoBehaviour, DayNightCycle.IDaytimeSensitive
{
public GameObject popup;
public AnimationCurve scaleCurve;
public float animationTime = 0.75f;
public float initialDelay = 0.5f;
public float showTime = 3f;
public TextMeshProUGUI targetText;
private bool inAnimation;
private void Start()
{
popup.SetActive(value: false);
DayNightCycle.Instance.RegisterDaytimeSensitiveObject(this);
}
public void OnDawn_AfterSunrise()
{
}
public void OnDawn_BeforeSunrise()
{
}
public void OnDusk()
{
if (!inAnimation)
{
StartCoroutine(PopUpAnimation());
}
}
private IEnumerator PopUpAnimation()
{
inAnimation = true;
popup.SetActive(value: true);
popup.transform.localScale = Vector3.zero;
float timer2 = 0f;
yield return new WaitForSeconds(initialDelay);
targetText.text = "<style=Body Numerals>" + (EnemySpawner.instance.Wavenumber + 1) + "</style><style=Body Bold>/</style><style=Body Numerals>" + EnemySpawner.instance.WaveCount;
StartCoroutine(PlaySoundDelayed());
while (timer2 < animationTime)
{
timer2 += Time.deltaTime;
popup.transform.localScale = Vector3.one * scaleCurve.Evaluate(Mathf.InverseLerp(0f, animationTime, timer2));
yield return null;
}
popup.transform.localScale = Vector3.one;
yield return new WaitForSeconds(showTime);
timer2 = 0f;
while (timer2 < animationTime)
{
timer2 += Time.deltaTime;
popup.transform.localScale = Vector3.one * scaleCurve.Evaluate(Mathf.InverseLerp(animationTime, 0f, timer2));
yield return null;
}
popup.transform.localScale = Vector3.zero;
popup.SetActive(value: false);
inAnimation = false;
}
private IEnumerator PlaySoundDelayed()
{
yield return new WaitForSeconds(0.1f);
ThronefallAudioManager.Oneshot(ThronefallAudioManager.AudioOneShot.ShowWaveCount);
}
}
|