private void TimerListen()
{
if (isItDone)
{
var spawners = FindObjectsOfType<AttackerSpawner>();
foreach (AttackerSpawner spawner in spawners)
{
spawner.StopSpawning();
}
CheckForEnemies();
}
else { return; }
}
private void CheckForEnemies()
{
if(listOfEnemies <= 0)
{
StartCoroutine("WinEvent");
}
else { return; }
}
IEnumerator WinEvent()
{
winBanner.SetActive(true);
yield return new WaitForSeconds(waitTime);
sceneLoader.LoadNextScene();
yield break;
}
I made it so that the bool that activates the foreach loop also uses the check for enemies method and starts a coroutine when enemies are 0. This can only happen when the fox timer is 0 so it won’t happen before then.
This is good yes?