private void CheckForDeadEnemies() { List <Enemy> enemiesToClear = new List <Enemy>(); for (int i = 0; i < EnemyList.Count(); i++) { Enemy enemy = EnemyList[i]; if (enemy.Death && !enemy.FlaggedForRemoval) { enemy.FlaggedForRemoval = true; enemiesToClear.Add(enemy); } } if (enemiesToClear.Count > 0) { RemoveEnemyEvent remove = new RemoveEnemyEvent(this, enemiesToClear); EnqueueAction(remove, EventPriority.ClearEnemies); } }
private void CheckForDeadEnemies() { List<Enemy> enemiesToClear = new List<Enemy>(); for (int i = 0; i < EnemyList.Count(); i++) { Enemy enemy = EnemyList[i]; if (enemy.Death && !enemy.FlaggedForRemoval) { enemy.FlaggedForRemoval = true; enemiesToClear.Add(enemy); } } if (enemiesToClear.Count > 0) { RemoveEnemyEvent remove = new RemoveEnemyEvent(this, enemiesToClear); EnqueueAction(remove, EventPriority.ClearEnemies); } }