Hola, tengo una pregunta, yo tengo este script que me spawnea enemigos cada 3 segundos en 2 puntos(a mi eleccion) el cual se detiene cuando el player muere, lo que quisiera saber es que tengo que agregarle para que mi spawn me genere cierta cantidad de enemigos y despues de que mate a esa cantidad de enemigos estos me using UnityEngine;
using System.Collections;public class SpawnControlado : MonoBehaviour
{ public PlayerHealth playerHealth;
public GameObject enemy;
public float spawnTime = 3f;
public Transform[] spawnPoints;
void Start()
{
InvokeRepeating("Spawn", spawnTime, spawnTime);
}
void Spawn()
{
if (playerHealth.currentHp <= 0f)
{
return;
}
int spawnPointIndex = Random.Range(0, spawnPoints.Length);
Instantiate(enemy, spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation);
}
}
using System.Collections;public class SpawnControlado : MonoBehaviour
{ public PlayerHealth playerHealth;
public GameObject enemy;
public float spawnTime = 3f;
public Transform[] spawnPoints;
void Start()
{
InvokeRepeating("Spawn", spawnTime, spawnTime);
}
void Spawn()
{
if (playerHealth.currentHp <= 0f)
{
return;
}
int spawnPointIndex = Random.Range(0, spawnPoints.Length);
Instantiate(enemy, spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation);
}
}