Hey all i was wondering if someone would be able to show me a way to add a wait into this script so there is a gap between the last life lost and change of scene. This is what i came up with but I cant use returns in the IEnumerator in this sence. Thank you in advanced.
public int scoreValueMissedRed;
private GameMasterEndless gameMasterEndless;
public AudioClip clip;
IEnumerator OnTriggerEnter(Collider other)
{
if (other.tag == "level") {
return;
}
if (other.tag == "blackRobot") {
return;
}
if (other.tag == "blueRobot") {
return;
}
AudioSource.PlayClipAtPoint (clip, new Vector3 (0, 4, -12), 1.0f);
gameMasterEndless.AddScoreEndless (scoreValueMissedRed);
gameMasterEndless.Lives--;
if (gameMasterEndless.Lives < 0) {
gameMasterEndless.Lives = 0;
yield return new WaitForSeconds (1);
SceneManager.LoadScene (5);
}
Destroy (other.gameObject);
}
}