-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpawnManagerMM.cs
More file actions
32 lines (29 loc) · 1.22 KB
/
SpawnManagerMM.cs
File metadata and controls
32 lines (29 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnManagerMM : MonoBehaviour
{
[SerializeField]
private GameObject[] asteroidsMM;
void Start()
{
StartCoroutine(SpawningAsteroidRoutine());
}
IEnumerator SpawningAsteroidRoutine()
{
while (true)
{
int num = Random.Range(0, 3);
int num2 = Random.Range(0, 3);
Vector3 pos1 = new Vector3(Random.Range(-59, -63), Random.Range(-50, 50), Random.Range(43, 60));
Vector3 pos2 = new Vector3(Random.Range(59, 63), Random.Range(-50, 50), Random.Range(43, 60));
Vector3 pos3 = new Vector3(Random.Range(-59, -63), Random.Range(-50, 50), Random.Range(43, 60));
Vector3 pos4 = new Vector3(Random.Range(59, 63), Random.Range(-50, 50), Random.Range(43, 60));
Instantiate(asteroidsMM[num], pos1, Quaternion.identity);
Instantiate(asteroidsMM[num2], pos2, Quaternion.identity);
Instantiate(asteroidsMM[num], pos3, Quaternion.identity);
Instantiate(asteroidsMM[num2], pos4, Quaternion.identity);
yield return new WaitForSeconds(6f);
}
}
}