level now should end correctly every time
This commit is contained in:
parent
61b55ba30c
commit
394b07db60
7 changed files with 53 additions and 25 deletions
|
|
@ -13,6 +13,7 @@ public partial class LevelRunner : Node
|
|||
private bool rewardGiven = false;
|
||||
public float waveHealth = 0;
|
||||
public float waveHealthMax = 0;
|
||||
public int aliveZombies = 0;
|
||||
public List<RuntimeZombieData> zombies = [];
|
||||
[Export] private MoneyReward defaultReward;
|
||||
[Export] private RowSpawner rowSpawner;
|
||||
|
|
@ -128,12 +129,14 @@ public partial class LevelRunner : Node
|
|||
|
||||
if (waveIndex == resource.waves.Count - 1)
|
||||
{
|
||||
aliveZombies+=1;
|
||||
zombie.HasBeenKilled += OnLastZombieKilled;
|
||||
}
|
||||
}
|
||||
private void OnLastZombieKilled(RuntimeZombieData who)
|
||||
{
|
||||
if (waveHealth > 0) return;
|
||||
aliveZombies -= 1;
|
||||
if (aliveZombies > 0) return;
|
||||
|
||||
SpawnReward(who.GlobalPosition);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue