// Use this for initialization void Start() { //text.text = score; scoreText = GetComponent <Text>(); score = ScoreRecorder.score.ToString(); ScoreRecorder.ResetScore(); itemColor = scoreText.color; //Initialize with values set in Editor color.a = 1; color.r = itemColor.r; color.g = itemColor.g; color.b = itemColor.b; }
private void OnGUI() { if (nowState == Status.BEGIN) { GUI.Label(new Rect(500, 150, Screen.width / 2, 50), "点击Play,开始游戏!"); if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 25, 100, 50), "Play")) { nowState = Status.WATING; recorder.ResetScore(); } } else if (nowState == Status.OVER) { if (GUI.RepeatButton(new Rect(Screen.width / 2 - 50, Screen.height * 3 / 4 - 25, 100, 50), "Try again!")) { restart(); } } }