private void Update() { // checks based on how many enemies defeated if (isBeatByLeavingTrigger == false) { _objectiveCompleted = true; for (int i = 0; i < enemies.Count; i++) { if (enemies[i] != null) { _objectiveCompleted = false; break; } } if (_objectiveCompleted == true) { for (int i = 0; i < exitDoors.Count; i++) { if (exitDoors[i]) { exitDoors[i].SetActive(false); } } } if (_objectiveCompleted && isFinalObjective) { _gameFlowManager.SetLevelComplete(true); } } }