Skip to content

Instantly share code, notes, and snippets.

@curious-username
Last active November 17, 2021 02:43
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/e18d899e1e6538bb8cb743fcacab8c4b to your computer and use it in GitHub Desktop.
Save curious-username/e18d899e1e6538bb8cb743fcacab8c4b to your computer and use it in GitHub Desktop.
slow down effect
IEnumerator SpawnPowerupRoutine()
{
//every 3 - 7 seconds, spawn in a powerup
while (_stopSpawning == false)
{
float _randomSpawnPosition = Random.Range(-9.0f, 9.0f);
Vector3 spawn = new Vector3(_randomSpawnPosition, 7, 0);
_randomPowerup = Random.Range(0, 7);
if (_bigLaserCount == 5)
{
Instantiate(_powerups[6], spawn, Quaternion.identity);
_bigLaserCount = 0;
}
else
{
_randomPowerup = Random.Range(0, 6);
Instantiate(_powerups[_randomPowerup], spawn, Quaternion.identity);
_bigLaserCount++;
}
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