Changing enemy after scoreValue = 15

So I’m developing this survival shooter and want the enemy type to change after a score of 15 (15 kills). I’m a total beginner at unity and pretty much don’t understand any of it, although I do want to learn. Everything is pretty much foreign to me so please forgive my noobness,

So far I have been able to get the GUI Text going and every time I kill an enemy it adds to the score count. I have two c# scripts that accomplish this.

using UnityEngine;
using System.Collections;

public class GameController : MonoBehaviour
{
	public GameObject hazard;
	public Vector3 spawnValues;
	public int hazardCount;
	public float spawnWait;
	public float startWait;
	public float waveWait;
	
	public GUIText scoreText;
	public GUIText restartText;
	public GUIText gameOverText;
	
	private bool gameOver;
	private bool restart;
	private int score;
	
	void Start ()
	{
		gameOver = false;
		restart = false;
		restartText.text = "";
		gameOverText.text = "";
		score = 0;
		UpdateScore ();
		StartCoroutine (SpawnWaves ());
	}
	
	void Update ()
	{
		if (restart)
		{
			if (Input.GetKeyDown (KeyCode.R))
			{
				Application.LoadLevel (Application.loadedLevel);
			}
		}
	}
	
	IEnumerator SpawnWaves ()
	{
		yield return new WaitForSeconds (startWait);
		while (true)
		{
			for (int i = 0; i < hazardCount; i++)
			{
				Vector3 spawnPosition = new Vector3 (Random.Range (-spawnValues.x, spawnValues.x), Random.Range (-spawnValues.y, spawnValues.y), Random.Range(-spawnValues.z, spawnValues.z));
				Quaternion spawnRotation = Quaternion.identity;
				Instantiate (hazard, spawnPosition, spawnRotation);
				yield return new WaitForSeconds (spawnWait);
			}
			yield return new WaitForSeconds (waveWait);
			
			if (gameOver)
			{
				restartText.text = "Press 'R' for Restart";
				restart = true;
				break;
			}
		}
	}
	
	public void AddScore (int newScoreValue)
	{
		score += newScoreValue;
		UpdateScore ();
	}
	
	void UpdateScore ()
	{
		scoreText.text = "Score: " + score;
	}
	
	public void GameOver ()
	{
		gameOverText.text = "Game Over!";
		gameOver = true;
	}
}

And

using UnityEngine;
using System.Collections;

public class DestroyByContact : MonoBehaviour
{
	public GameObject explosion;
	public GameObject playerExplosion;
	public int scoreValue;
	private GameController gameController;

	
	//reference to the next asteriod.
	public GameObject ChildAsteroid;
	
	//Number of child asteroids to spawn.
	public int NumChildAsteroid;
	
	void Start ()
	{

	
		GameObject gameControllerObject = GameObject.FindWithTag ("GameController");
		if (gameControllerObject != null)
		{
			gameController = gameControllerObject.GetComponent <GameController>();
		}
		if (gameController == null)
		{
			Debug.Log ("Cannot find 'GameController' script");
		}
	}
	
	void OnTriggerEnter(Collider other) 
	{
		if (other.tag == "Boundary")
		{
			return;
		}
		Instantiate(explosion, transform.position, transform.rotation);
		if (other.tag == "Player")
		{
			Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
			gameController.GameOver ();
		}
		gameController.AddScore (scoreValue);
		Destroy(other.gameObject);
		Destroy(gameObject);

		{
			
			if (ChildAsteroid != null)
			{
				for (int i =0; i < NumChildAsteroid; i++) {
					Instantiate (ChildAsteroid, transform.position, new Quaternion ());
				}
			}
		}


	}
}

You should play with Arrays! Arrays are “Tables” that contents severals and different gameobjects or any other var. So, let’s say this:

public GameObject[] hazard;

By adding “” you simply declare an array. Drag and drop any enemies you want in your Hazard array and create an Int named a.

In void Update()

if (score >= 15 && a < 1)
{
    a += 1;
}

//if (score >= 50 && a < 2)
//{
//    a += 1;
//}
//ETC...

Now in your IEnumerator SpawnWaves ():

IEnumerator SpawnWaves ()
     {
         yield return new WaitForSeconds (startWait);
         while (true)
         {
             for (int i = 0; i < hazardCount; i++)
             {
                 Vector3 spawnPosition = new Vector3 (Random.Range (-spawnValues.x, spawnValues.x), Random.Range (-spawnValues.y, spawnValues.y), Random.Range(-spawnValues.z, spawnValues.z));
                 Quaternion spawnRotation = Quaternion.identity;
                 if (hazard[a] != null)
                 {
                     Instantiate (hazard[a], spawnPosition, spawnRotation);
                 }
                 yield return new WaitForSeconds (spawnWait);
             }
             yield return new WaitForSeconds (waveWait);
             
             if (gameOver)
             {
                 restartText.text = "Press 'R' for Restart";
                 restart = true;
                 break;
             }
         }
     }

Oh yeah, by the way, I don’t care about code “indentation”! When people wan’t to help, they simply do :wink:

Math