private IEnumerator CreateEnemy(string enemyName, int number) { //the first wave enemy for (int i = 0; i < number; i++) { EnemySpawnManager._instance.enemyList.Add(enemySpawn.EnemyBorn(enemyName)); yield return(new WaitForSeconds(1f)); } while (EnemySpawnManager._instance.enemyList.Count > 0) { yield return(new WaitForSeconds(0.2f)); } }