Question by
DanRigg11 · Sep 12, 2015 at 12:15 PM ·
c#spawning problemsmanagerenemy spawnwaves
Survival Shooter Spawn Enemies in Waves?
Hi guys i just finished the Suvrival Shooter tutorial with unity and I want to include Waves... I think I'd no how to how to display the level number but what would I have to change in the enemy spawn script to create Waves.
using UnityEngine;
public class EnemyManager : MonoBehaviour { public PlayerHealth playerHealth; public GameObject enemy; public float spawnTime = 3f; public Transform[] spawnPoints;
void Start ()
{
InvokeRepeating ("Spawn", spawnTime, spawnTime);
}
void Spawn ()
{
if(playerHealth.currentHealth <= 0f)
{
return;
}
int spawnPointIndex = Random.Range (0, spawnPoints.Length);
Instantiate (enemy, spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation);
}
}
Thanks
Comment
Your answer
Follow this Question
Related Questions
Can't spawn more than one NavMeshAgent wave system 0 Answers
wave spawner difficulty increase 1 Answer
How can I change scene or Quit game after killing all the spawned enemies? 1 Answer
SceneManager: how can I find GameObject in another scene? 1 Answer
Change in Editor via Script Values of another Script 2 Answers