I want to stop the game when the score reaches 10 but the code i have doesnt work. I have the score working and it counts up fine but nothing happens at the score 10
static var score : int = 0;
var guiScore : GUIText;
function Start () {
guiScore.text = "Green = 0";
}
var playerScore :int = 0;
var computerScore :int = 0;
private var scoreMax : int = 10;
function Update ()
{
if(score = 10)
{
pause.enabled = true;
Time.timeScale = 0;
Screen.showCursor = true;
}
}
function OnCollisionEnter2D(col : Collision2D){
if (col.collider.name == "GoalFieldG"){
score += 1;
guiScore.text = "Green = " + score;
print ("Point Scored");
}
}