So far I’ve got the code for 3 spawn points and 2 enemies. The code will select one spawn at random, then it will select one of the 2 enemies to spawn at the selected spawn point.
One of the enemies is like a mini-boss, so a reduced spawn rate would be helpful.
Ps. All of this is in C# before you go ahead and look at the code (I know some people like to work in other coding languages)
public GameObject[] Enemy;
public Transform[] EnemySpawn;
private float ReSpawnTimer;
public float ReSpawnRate;
void Start ()
{
ReSpawnRate = 300;
int spawnPointIndex = Random.Range (0, EnemySpawn.Length);
Instantiate (Enemy[Random.Range(0,Enemy.Length)], EnemySpawn [spawnPointIndex].position, EnemySpawn [spawnPointIndex].rotation);
}
void Update ()
{
ReSpawnTimer = ReSpawnTimer + 1;
if (ReSpawnTimer >= ReSpawnRate)
{
ReSpawnTimer = 0;
Spawn ();
}
}
void Spawn ()
{
int spawnPointIndex = Random.Range (0, EnemySpawn.Length);
Instantiate (Enemy[Random.Range(0,Enemy.Length)] , EnemySpawn [spawnPointIndex].position, EnemySpawn [spawnPointIndex].rotation);
}
Any help in this would be greatly appreciated. And thanks, in advance.