reset WaveObserver state wip
This commit is contained in:
parent
8804450d99
commit
18b97c4fd9
@ -20,10 +20,20 @@ public class WaveObserver : Singleton<WaveObserver>
|
|||||||
|
|
||||||
public void Init(WaveConfig config)
|
public void Init(WaveConfig config)
|
||||||
{
|
{
|
||||||
|
_subjects.Clear();
|
||||||
|
_aliveEnemyCount.Clear();
|
||||||
|
_intervalTiming.Clear();
|
||||||
|
|
||||||
_levelConfig = Object.Instantiate(config);
|
_levelConfig = Object.Instantiate(config);
|
||||||
_copyConstantSpawn = new List<int>();
|
_copyConstantSpawn = new List<int>();
|
||||||
_copyGroupSpawn = new List<List<int>>();
|
_copyGroupSpawn = new List<List<int>>();
|
||||||
_groupSpawnTimers = new List<float>();
|
_groupSpawnTimers = new List<float>();
|
||||||
|
|
||||||
|
_spawnerTiming = 0;
|
||||||
|
_currentGroupIndex = 0;
|
||||||
|
_once = true;
|
||||||
|
|
||||||
|
|
||||||
if (!_levelConfig)
|
if (!_levelConfig)
|
||||||
{
|
{
|
||||||
Debug.LogError("level config was null");
|
Debug.LogError("level config was null");
|
||||||
@ -59,6 +69,7 @@ public class WaveObserver : Singleton<WaveObserver>
|
|||||||
*/
|
*/
|
||||||
public void Attach(SpawnerTile spawnerSubject)
|
public void Attach(SpawnerTile spawnerSubject)
|
||||||
{
|
{
|
||||||
|
if (_subjects.Contains(spawnerSubject)) return;
|
||||||
|
|
||||||
spawnerSubject.Prefab = _levelConfig.GetRandomSpawn().GetEnemyObject();
|
spawnerSubject.Prefab = _levelConfig.GetRandomSpawn().GetEnemyObject();
|
||||||
_subjects.Add(spawnerSubject);
|
_subjects.Add(spawnerSubject);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user