void CheckEnemyState()//Is enemy idle or not { bool inFormation = false; for (int i = spawnedEnemies.Count - 1; i >= 0; i--) { if (spawnedEnemies[i].GetComponent <EnemyBehavior>().enemyState != EnemyBehavior.EnemyStates.IDLE) { inFormation = false; Invoke("CheckEnemyState", 1f); break; } } inFormation = true; if (inFormation) //Start all spread routines, stop checking { StartCoroutine(flyFormation.ActivateSpread()); StartCoroutine(waspFormation.ActivateSpread()); StartCoroutine(bossFormation.ActivateSpread()); CancelInvoke(); } }