Ok, so im a new programmer, so my code is a little messy. but i will give you what i have completed. What I am hoping to accomplish is:
-
Create a wave spawn system with slight delay between spawns so enemy prefabs dont stack up and controlled wave delay between waves.
-
Randomize which empty game object (spawn point) is used to instantiate the prefabs. there will be four separate points.
-
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.)
using UnityEngine;
using System.Collections;public class SpawnForWave : MonoBehaviour
{public int WaveCount = 1; private int EnemyCount = 0; private int Ammount2Spawn = 10; private GameObject SpawnPoints = GameObject.FindGameObjectWithTag("Spawn Point"); public GameObject EnemyPref1; public GameObject EnemyPref2; public GameObject EnemyPref3; public GameObject EnemyPref4; void Update () { if(WaveCount = 1) { for(int i = 0; i < Ammount2Spawn; i++) { Instantiate(EnemyPref1, SpawnPoints.position, SpawnPoints.rotation); Instantiate(EnemyPref2, SpawnPoints.position, SpawnPoints.rotation); Instantiate(EnemyPref3, SpawnPoints.position, SpawnPoints.rotation); Instantiate(EnemyPref4, SpawnPoints.position, SpawnPoints.rotation); } } }
}