private void SpawnOneEnemy() { if (spawnStack.Count == 0) { spawnStack = ListUtils.CreateShuffledStack(spawnPoints); } if (burst.Count == 0) { // Get a Stack of the next round of enemies to be spawned burst = waveConfig.CreateEnemyBurst(); } // Position the new Enemy var enemy = Instantiate(burst.Pop(), enemyParent.transform); var sp = spawnStack.Pop(); enemy.transform.position = sp.transform.position; // Get the Asteroids moving var asteroid = enemy.GetComponent <AsteroidMovement>(); if (asteroid) { SetAsteroidMovement(sp, asteroid); } PublishOnEnemySpawnedEvent(); }