Hello I am making a zombie survival game and I want to Spawn a number of enemy’s on the map can you help here is my code I am using unity 5 thank you.
using UnityEngine;
using System.Collections;
public class GameManagement : MonoBehaviour {
public int round = 1;
int zombesInRound = 5;
int zombiesSpawnInRound = 0;
float zombieSpawnTimer = 0;
public Transform[] zombieSpawnPoints;
public GameObject zombieEnemy;
void Start () {
}
void Update () {
if (zombiesSpawnInRound < zombesInRound)
{
if(zombieSpawnTimer > 30)
{
SpawnZombie ();
zombieSpawnTimer = 0;
}
else
{
zombieSpawnTimer++;
}
}
}
void SpawnZombie()
{
Vector3 randomSpawnPiont = zombieSpawnPoints[Random.Range (0, zombieSpawnPoints.Length)].position;
Instantiate(zombieEnemy,randomSpawnPiont,Quaternion.identity);
zombesInRound ++;
}
}