Im currently developing an android space shooting game.
And i wanted to make wave system for it that would work something like this:
So mine main problem is that idk how to check if i have any enemies alive
Does anybody have an idea?
Here is my spawner Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WaveSystem : MonoBehaviour
{
public Wave[] waves;
public float range;
private void Start() {
SpawnWave();
}
void SpawnWave()
{
for (int i = 0; i < waves.Length; i++)
{
for (int g = 0; g < waves*.objectsToSpawn.Length; g++)*
{
SpawnEnemy(waves*.objectsToSpawn[g]);*
}
}
}
void SpawnEnemy(GameObject enemyToSpawn)
{
Transform player = GameObject.FindGameObjectWithTag(“Player”).GetComponent();
Vector2 spawnPos = player.position;
spawnPos += Random.insideUnitCircle * range;
Instantiate(enemyToSpawn, spawnPos, Quaternion.identity);
}
}
Here is my wave Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class Wave
{
[SerializeField]
public GameObject[] objectsToSpawn;
}