like Nick4 said, you can define a list of spawn places, if you create an array and hold the spawn places in there you can randomly choose different meteor prefabs (assuming u want some uniqueness) and then randomly spawn the amount, and random range location of them.
For example (this wont be 100% accurate nor complete but an outline)
private bool CheckForMeteorPrefabs() {
if (meteorPrefab.Length > 0)
return true;
else
return false;
}
private bool CheckForSpawnPoints() {
if (spawnPoints.Length > 0)
return true;
else
return false;
}
//generate a list of available spawnpoints that do not have any meteors childed to it
private GameObject[] AvailableSpawnPoints() {
List gos = new List();
for(int cnt = 0; cnt < spawnPoints.Length; cnt++) {
if (spawnPoints[cnt].transform.childCount == 0) {
Debug.Log("**meteor spawn point available**");
gos.Add(spawnPoints[cnt]);
}
}
↧