Skip to content

Instantly share code, notes, and snippets.

@curious-username
Created October 14, 2021 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save curious-username/9a0c360c179955926a4cc29e05a5b259 to your computer and use it in GitHub Desktop.
Save curious-username/9a0c360c179955926a4cc29e05a5b259 to your computer and use it in GitHub Desktop.
updating the spawn manager
IEnumerator SpawnPowerupRoutine()
{
//every 3 - 7 seconds, spawn in a powerup
while (_stopSpawning == false) {
Vector3 spawn = new Vector3(Random.Range(-8f, 8f), 7, 0);
int randomPowerUp = Random.Range(0, 4);
Instantiate(_powerups[randomPowerUp], spawn, Quaternion.identity);
yield return new WaitForSeconds(Random.Range(3, 8));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment