#pragma strict
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()
{
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");
}
}
答案 0 :(得分:0)
放入
var level : int;
然后开始
level = PlayerPrefs.GetInt("level",0);
然后在你的if(GUI.Buttons){}
if(level >= 2){}
和
if(level >= 3){}
依此类推,在你的实际级别中,一旦他们完成了这个级别就在你的playerprefs中设置了int,可能再次加载int并使用if来检查它是否大于然后替换,如果它不是
编辑:
var levelnum : int = 2;
PlayerPrefs.SetInt("level",levelnum);