Finished waveUI
This commit is contained in:
parent
3140d6880e
commit
2129a89a6a
|
@ -2395,6 +2395,10 @@ PrefabInstance:
|
|||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 1656765803503857110, guid: 48e0e53445d42474895d37a321c39d1c, type: 3}
|
||||
propertyPath: spawner
|
||||
value:
|
||||
objectReference: {fileID: 5796191506433166634}
|
||||
- target: {fileID: 2404937059918327841, guid: 48e0e53445d42474895d37a321c39d1c, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
|
@ -2645,6 +2649,17 @@ PrefabInstance:
|
|||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: c53e6971c95afb1429cd82616a7b6737, type: 3}
|
||||
--- !u!114 &5796191506433166634 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 3603265075407754381, guid: c53e6971c95afb1429cd82616a7b6737, type: 3}
|
||||
m_PrefabInstance: {fileID: 5796191506433166633}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8a592fac78e06964b863b67047a446a1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1001 &7693964683212020007
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -18,16 +18,16 @@ public class EnemySpawner : MonoBehaviour
|
|||
|
||||
// Inspector
|
||||
[SerializeField] private float difficultyIncreasePerWave = 1f;
|
||||
[SerializeField] private float WaveTime = 20f;
|
||||
[SerializeField] public float WaveTime = 20f;
|
||||
[SerializeField] private List<float> enemyDifficulties;
|
||||
[SerializeField] private float SpawnRadius = 10;
|
||||
[SerializeField] private int NumEnemies = 6;
|
||||
[SerializeField] private GameObject[] players;
|
||||
[SerializeField] private float initialSpawnDelay = 5;
|
||||
|
||||
// Private
|
||||
// local
|
||||
private bool nextWaveRequested = false;
|
||||
private float timer = 0f;
|
||||
public float timer = 0f;
|
||||
private Camera mainCam;
|
||||
private GameObject SpawnedEnenmyHolder;
|
||||
[SerializeField] private List<EnemyPrefabInfo> enemyList;
|
||||
|
|
|
@ -6,6 +6,36 @@ using UnityEngine.UI;
|
|||
|
||||
public class WaveUI : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private EnemySpawner spawner;
|
||||
[SerializeField] private Slider slider;
|
||||
[SerializeField] private TMP_Text waveText;
|
||||
[SerializeField] private float waveTextDisplayTime = 3f;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
waveText.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
int prevWave = 0;
|
||||
private void Update()
|
||||
{
|
||||
float waveProgressTime = spawner.timer / spawner.WaveTime;
|
||||
slider.value = waveProgressTime;
|
||||
|
||||
if (prevWave != spawner.Wave)
|
||||
{
|
||||
prevWave = spawner.Wave;
|
||||
StartCoroutine(ShowWave());
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator ShowWave()
|
||||
{
|
||||
waveText.gameObject.SetActive(true);
|
||||
waveText.text = $"Wave: {spawner.Wave}";
|
||||
|
||||
yield return new WaitForSecondsRealtime(waveTextDisplayTime);
|
||||
|
||||
waveText.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue