I will attach a link to the video of what I am looking for and what I have and all my code, but well I will let the video show not tell haha
Video: - YouTube
Code:
Spawner:
public class Spawner : MonoBehaviour
{
public GameObject balloon;
public Vector3 spawnValues;
public int balloonCount;
public float spawnWait;
public float startWait;
public float waveWait;
void Start ()
{
StartCoroutine (SpawnWaves ());
}
IEnumerator SpawnWaves ()
{
yield return new WaitForSeconds (startWait);
while (true)
{
for (int i = 0; i < balloonCount; i++)
{
Vector3 spawnPosition = new Vector3 (Random.Range (-spawnValues.x, spawnValues.x), spawnValues.y, spawnValues.z);
Quaternion spawnRotation = Quaternion.identity;
Instantiate (balloon, spawnPosition, spawnRotation);
yield return new WaitForSeconds (spawnWait);
}
yield return new WaitForSeconds (waveWait);
}
}
}
Code to pop the balloons on click:
using UnityEngine;
using System.Collections;
public class Popper : MonoBehaviour {
void OnMouseDown()
{
Destroy (gameObject);
}
}
Despawner Unpopped Balloons:
using UnityEngine;
using System.Collections;
public class Destroy : MonoBehaviour {
void OnTriggerEnter ( Collider other)
{
if(other.gameObject.tag == "Destroyer"){
Destroy (gameObject);
}
}
}
Thanks not for any help all is appreciated!