private void OnGUI() { if (!ss) { S = Time.time; } GUI.Label(new Rect(Screen.width - 160, 30, 150, 30), "Score: " + UserActionController.GetScore().ToString() + " Time: " + ((int)(Time.time - S)).ToString()); if (ss) { if (!UserActionController.GetGameState()) { ss = false; } } else { if (GUI.Button(new Rect(Screen.width / 2 - 30, Screen.height / 2 - 30, 100, 50), "Start")) { ss = true; SceneController.LoadResources(); S = Time.time; UserActionController.Restart(); } } }
private void OnGUI() { if (!ss) { S = Time.time; } GUI.Label(new Rect(0, 30, 75, 30), "Crystal: " + SceneController.GetCollector().ToString()); GUI.Label(new Rect(Screen.width - 160, 30, 150, 30), "Score: " + UserActionController.GetScore().ToString() + " Time: " + ((int)(Time.time - S)).ToString()); if (ss) { if (!UserActionController.GetGameState()) { ss = false; } if (SceneController.GetCollector() >= 9) { win = true; ss = false; } } else { if (win) { GUIStyle fontStyle = new GUIStyle(); fontStyle.alignment = TextAnchor.MiddleCenter; fontStyle.fontSize = 25; fontStyle.normal.textColor = Color.white; GUI.Label(new Rect(Screen.width / 2 - 25, Screen.height / 2 - 80, 100, 50), "WINNER!", fontStyle); PF = PropFactory.PF; PF.StopPatrol(); if (GUI.Button(new Rect(Screen.width / 2 - 30, Screen.height / 2 - 30, 100, 50), "EXIT")) { UnityEditor.EditorApplication.isPlaying = false; } } else if (GUI.Button(new Rect(Screen.width / 2 - 30, Screen.height / 2 - 30, 100, 50), "Start")) { ss = true; SceneController.LoadResources(); S = Time.time; UserActionController.Restart(); } } }
private void OnGUI() { if (start) { lastTime = ((int)(Time.time - startTime)); GUI.Label(new Rect(50, 30, 200, 30), "Score: " + (userAction.GetScore() / 4).ToString() + " Time: " + lastTime.ToString()); if (!userAction.GetGameState()) { start = false; } } else { GUI.Label(new Rect(50, 30, 200, 30), "Score: " + (userAction.GetScore() / 4).ToString() + " Time: " + lastTime.ToString()); if (GUI.Button(new Rect(Screen.width / 2 - 30, Screen.height / 2 - 30, 100, 50), "Start")) { start = true; userAction.Restart(); startTime = Time.time; } } }