When my character hits the door I want him to go to win Screen but I have no idea how. I copied and pasted a code from my Title screen that when I press Play it goes into the game. But I don't know how to track "if character hits door go to next screen".
Here is my code:
function UpdateScoreText()
{
//update the GUI Text on screen
scoreText.text = "Score: " + score;
}
function OnCollisionEnter(c:Collision)
{
if (c.gameObject.name == "vase" )
{
Destroy(c.gameObject); // destroys the thing this script bumped into
score += 100;
UpdateScoreText();
}
if (c.gameObject.name == "shield" )
{
Destroy(c.gameObject); // destroys the thing this script bumped into
score += 500;
UpdateScoreText();
}
if (c.gameObject.name == "foxmask2" )
{
Destroy(c.gameObject); // destroys the thing this script bumped into
score += 900;
UpdateScoreText();
}
if (c.gameObject.name == "boots2" )
{
Destroy(c.gameObject); // destroys the thing this script bumped into
score += 200;
UpdateScoreText();
}
if (c.gameObject.name == "backdoor" )
{
if(level.Equals("Quit"))
{
Application.Quit();
}
else
{
Application.LoadLevel(level);
audio.Play();
}
}
}
Here is my backdoor with a rigid body
Here is my Win Screen