Last active
November 17, 2021 02:43
-
-
Save curious-username/e18d899e1e6538bb8cb743fcacab8c4b to your computer and use it in GitHub Desktop.
slow down effect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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