Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Transform[] spawn_spots;
- public GameObject enemy;
- public float GameTime, seconds;
- public bool wave_1, wave_2, wave_3 = false;
- void Update()
- {
- seconds = (int)(GameTime % 60f);
- GameTime += Time.deltaTime;
- if (seconds == 5)
- {
- wave_1 = true;
- if (wave_1)
- {
- InvokeRepeating("Spawn", 3.0f, 3.0f);
- }
- }
- if (seconds == 10)
- {
- wave_2 = true;
- wave_1 = false;
- if (wave_2)
- {
- InvokeRepeating("Spawn_2", 5.0f, 5.0f);
- }
- }
- }
- void Spawn()
- {
- int spawnPointIndex = Random.Range(0, spawn_spots.Length);
- Instantiate(enemy, spawn_spots[spawnPointIndex].position, spawn_spots[spawnPointIndex].rotation);
- }
- void Spawn_2()
- {
- int spawnPointIndex = Random.Range(0, spawn_spots.Length);
- Instantiate(enemy, spawn_spots[spawnPointIndex].position, spawn_spots[spawnPointIndex].rotation);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement