Compare commits
No commits in common. "258b467857b8c7860efb67870abd8d512d019b57" and "f632ee471a94f83955a8a66bf17becf6acbd1f6d" have entirely different histories.
258b467857
...
f632ee471a
|
@ -2,13 +2,9 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class EnemySpawnManager : MonoBehaviour
|
||||
{
|
||||
public bool HasStarted = false;
|
||||
public bool IsAutoPlaying = false;
|
||||
|
||||
private float time = 0f;
|
||||
[SerializeField] private LevelDefinition levelDefinition;
|
||||
[SerializeField] private EnemyCollection enemyCollection;
|
||||
|
@ -16,41 +12,11 @@ public class EnemySpawnManager : MonoBehaviour
|
|||
[SerializeField] private WaypointPath groundPath;
|
||||
[SerializeField] private WaypointPath skyPath;
|
||||
|
||||
[Header("Buttons")]
|
||||
|
||||
[SerializeField] private Button StartButton;
|
||||
[SerializeField] private Button NextButton;
|
||||
[SerializeField] private Button AutoPlayButton;
|
||||
|
||||
private Queue<Wave> waveQueue;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
waveQueue = new Queue<Wave>(levelDefinition.Waves);
|
||||
|
||||
if (StartButton != null)
|
||||
StartButton.onClick.AddListener(OnStartButtonClicked);
|
||||
if (NextButton != null)
|
||||
NextButton.onClick.AddListener(OnNextButtonClicked);
|
||||
if (AutoPlayButton != null)
|
||||
AutoPlayButton.onClick.AddListener(ToggleAutoPlayClicked);
|
||||
}
|
||||
|
||||
public void OnStartButtonClicked()
|
||||
{
|
||||
HasStarted = true;
|
||||
PopWave();
|
||||
}
|
||||
|
||||
public void OnNextButtonClicked()
|
||||
{
|
||||
time = waveQueue.Peek().spawnTime;
|
||||
PopWave();
|
||||
}
|
||||
|
||||
public void ToggleAutoPlayClicked()
|
||||
{
|
||||
IsAutoPlaying = !IsAutoPlaying;
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
@ -60,7 +26,6 @@ public class EnemySpawnManager : MonoBehaviour
|
|||
return;
|
||||
}
|
||||
|
||||
if (HasStarted && IsAutoPlaying)
|
||||
time += Time.deltaTime;
|
||||
|
||||
if (waveQueue.Peek().spawnTime < time)
|
||||
|
|
Loading…
Reference in New Issue