I dont recomand using this for spawn points:
private GameObject SpawnPoints = GameObject.FindGameObjectWithTag("Spawn Point");
If you do this then it will have to search for it everytime.
Just declare it as public and add it in the inspector.
1. Create a wave spawn system with slight delay between spawns so enemy prefabs dont stack up and controlled wave delay between waves.
To do this you must create a new IEnumerator class and add wait for second calls like this:
Just an example:
IEnumerator example()
{
Instantiate(EnemyPref1, SpawnPoints.position, SpawnPoints.rotation);
yield return new WaitForSeconds(Random.Range(1,5));
}
To call this function do it like this:
StartCoroutine(example());
2.Randomize which empty game object (spawn point) is used to instantiate the prefabs. there will be four separate points.
You can create a start a random number then asign with if statements for a value to spawn at a prefab.
3.Spawn specific enemies, not random, for each wave. So basically, i would have the ability to declare which enemy prefabs spawn on which waves with not pattern at all. (I understand this part will be time consuming.)
You can just make a whole new function and with yields and timers spawn them just like that.
↧