Comments + variable structure
This commit is contained in:
parent
bc4b4c30a8
commit
bd28e30da5
@ -15,10 +15,10 @@ public class WaveConfig : ScriptableObject
|
||||
[SerializeField]
|
||||
private List<GroupList> _nestedGroupSpawn = new List<GroupList>();
|
||||
[SerializeField]
|
||||
private List<GameObject> _constraintList = new List<GameObject>(); //List of depleted enemies
|
||||
private float _gameDuration = 1;
|
||||
private float _enemySpawndOnStart = 0;
|
||||
private int _enemySum = 0;
|
||||
private List<GameObject> _constraintList = new List<GameObject>();
|
||||
public List<EnemyType> ConstantSpawn
|
||||
{
|
||||
get
|
||||
@ -57,6 +57,8 @@ public class WaveConfig : ScriptableObject
|
||||
|
||||
/**
|
||||
* Returns a random enemy among the constantSpawn list
|
||||
* Called when assigning a new enemy to a spawner
|
||||
* <param name="constraint"> When given, ensures that assigned enemy hasn't depleted </param>
|
||||
*/
|
||||
public EnemyType GetRandomSpawn(GameObject constraint = null)
|
||||
{
|
||||
|
||||
@ -5,17 +5,18 @@ using UnityEngine;
|
||||
|
||||
public class WaveObserver : Singleton<WaveObserver>
|
||||
{
|
||||
private const int MAXTOUGHNESS = 10;
|
||||
|
||||
private List<SpawnerTile> _subjects = new List<SpawnerTile>();
|
||||
private List<float> _aliveEnemyCount = new List<float>();
|
||||
private List<int> _copyConstantSpawn;
|
||||
private List<List<int>> _copyGroupSpawn; //Contains count of enemies per group
|
||||
private List<float> _groupSpawnTimers;
|
||||
private WaveConfig _levelConfig;
|
||||
private const int MAXTOUGHNESS = 10;
|
||||
private int _spawnerTiming = 0;
|
||||
private List<int> _copyConstantSpawn;
|
||||
private List<int> _intervalTiming = new List<int>();
|
||||
private bool _once = true;
|
||||
private List<List<int>> _copyGroupSpawn; //Contains count of enemies per group
|
||||
private WaveConfig _levelConfig;
|
||||
private int _spawnerTiming = 0;
|
||||
private int _currentGroupIndex = 0;
|
||||
private bool _once = true;
|
||||
|
||||
public void Init(WaveConfig config)
|
||||
{
|
||||
@ -83,14 +84,12 @@ public class WaveObserver : Singleton<WaveObserver>
|
||||
{
|
||||
if (_copyConstantSpawn[spawnIndex] == 0) //Doesn't compare this iteration because it's already empty
|
||||
{
|
||||
Debug.Log("--I'm empty--");
|
||||
continue;
|
||||
}
|
||||
if (paramPrefab.Equals(_levelConfig.ConstantSpawn[spawnIndex].GetEnemyObject()))
|
||||
{
|
||||
_copyConstantSpawn[spawnIndex]--;
|
||||
|
||||
Debug.Log("Amout to spawn is now: " + _copyConstantSpawn[spawnIndex]);
|
||||
if (_copyConstantSpawn[spawnIndex] == 0)
|
||||
{
|
||||
foreach (SpawnerTile spawner in _subjects)
|
||||
@ -101,12 +100,10 @@ public class WaveObserver : Singleton<WaveObserver>
|
||||
if (randomEnemy?.GetEnemyObject() == spawner.Prefab || randomEnemy == null)
|
||||
{
|
||||
spawner.StopSpawn();
|
||||
Debug.Log("----Spawn Stopped----");
|
||||
}
|
||||
else
|
||||
{
|
||||
spawner.Prefab = randomEnemy.GetEnemyObject();
|
||||
Debug.Log("----Spawn Changed!!!----");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,7 +219,7 @@ public class WaveObserver : Singleton<WaveObserver>
|
||||
if (_copyGroupSpawn[_currentGroupIndex][groupIndex] != 0)
|
||||
{
|
||||
CycleRows(usedRows, currentGroup, groupIndex);
|
||||
/*If group is done OR max rows reached while group is not done*/
|
||||
// If group is done OR max rows reached while group is not done
|
||||
if (_copyGroupSpawn[_currentGroupIndex][groupIndex] > 0 || (usedRows.Count == _subjects.Count && _copyGroupSpawn[_currentGroupIndex][groupIndex] > 0))
|
||||
{
|
||||
return false;
|
||||
|
||||
@ -60,9 +60,7 @@ public class SpawnerTile : LevelTile
|
||||
}
|
||||
}
|
||||
}
|
||||
//Debug.Log("Time: " + _spawnCounter);
|
||||
if (_spawnCounter < _spawnSpeed) return;
|
||||
Debug.Log("Stopped but still spawning");
|
||||
_spawnCounter = 0;
|
||||
if (!_cooldownEnded)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user