0
我通過使用GUI.enabled = false
禁用了我的Guibuttons如何每次遊戲結束時重新啓用它?我想在完成遊戲後解鎖我的按鈕OnGui
請幫助謝謝:)
#pragma strict
var sign : Texture;
var challenge1 : Texture;
var challenge2 : Texture;
var challenge3 : Texture;
var LevelOneEnabled = true;
var LevelTwoEnabled = false;
var LevelThreeEnabled = false;
var Score : TextMesh;
var Score2 : TextMesh;
var Score3 : TextMesh;
function Start(){
}
function Awake(){
Score.text = "Highscore: "+ PlayerPrefs.GetInt("JeepneyScore");
Score2.text = "Highscore: "+ PlayerPrefs.GetInt("JeepneyScore2");
Score3.text = "Best Time: "+ PlayerPrefs.GetFloat("JeepneyScore3");
}
function OnGUI()
{
if(GUI.Button(Rect(100,100,250,250),sign)){
Application.LoadLevel("Signs");
}
if(GUI.Button(Rect(550,500,280,80),"Back")){
Application.LoadLevel("Menu");
}
GUI.enabled = LevelOneEnabled;
if(GUI.Button(Rect(400,100,250,250),challenge1)){
Application.LoadLevel("LoadScene");
}
GUI.enabled = LevelTwoEnabled;
if(GUI.Button(Rect(700,100,250,250),challenge2)){
Application.LoadLevel("LoadScene2");
}
GUI.enabled = LevelThreeEnabled;
if(GUI.Button(Rect(1000,100,250,250),challenge3)){
Application.LoadLevel("LoadScene3");
}
}
請幫我這樣的人會是我