I'm about to throw my computer through a wall. This is a very, very, simple game. The code below explains the balls health and when the ball gets below a certain level the audio will say "GAME OVER". The sound is not playing, I have no idea what else to do and I get no errors.
#pragma strict
var MaxFallDistance = -10;
private var IsRestarting = false;
var GameOver : AudioClip;
function Update ()
{
if (transform.position.y <= MaxFallDistance)
{
if (IsRestarting == false);
{
RestartLevel();
}
}
}
function RestartLevel ()
{
IsRestarting = true;
GetComponent.<AudioSource>().clip = GameOver;
GetComponent.<AudioSource>().Play();
yield WaitForSeconds (GetComponent.<AudioSource>().clip.length);
Application.LoadLevel("game");
}