Last active
November 5, 2021 19:47
-
-
Save curious-username/95716c88cf26b2bb111d78e7576839d2 to your computer and use it in GitHub Desktop.
Spawnmanager changes for big laser
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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SpawnManager : MonoBehaviour | |
{ | |
[SerializeField] | |
private int _bigLaserCount; | |
private float _randomNumber; | |
private int _randomPowerup; | |
IEnumerator SpawnPowerupRoutine() | |
{ | |
//every 3 - 7 seconds, spawn in a powerup | |
while (_stopSpawning == false) { | |
_randomPowerup = Random.Range(0, 6); | |
_randomNumber = Random.Range(-8f, 8f); | |
Vector3 spawn = new Vector3(_randomNumber, 7, 0); | |
if (_bigLaserCount == 3) | |
{ | |
Instantiate(_powerups[5], spawn, Quaternion.identity); | |
_bigLaserCount = 0; | |
} | |
else | |
{ | |
_randomPowerup = Random.Range(0, 5); | |
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