I’m trying to switch scenes when the hp of my base reaches 0 and explodes but for some reason the scenes aren’t changing.
void Update () {
if(HP <= 0 && !dead)
{
// ... call the death function.
Death ();
animator.SetTrigger ("CoreExplosion");
}
}
void Death()
{
StartCoroutine(Explosion());
}
public IEnumerator Explosion()
{
// Check the random chance of taunting.
if (HP <= 0)
{
yield return new WaitForSeconds(0.6f);
Destroy (gameObject);
StartCoroutine(GameOver());
}
}
}
public IEnumerator GameOver()
{
yield return new WaitForSeconds(1.2f);
Application.LoadLevel ("Game Over");
}
Does anyone know how can I fix this?