void Update() { if (showScores) { if (Input.GetKey(KeyCode.Backspace)) { ScoreSaver.SetData(); //Time.timeScale = 1; Application.LoadLevel("WelkomScene"); } if (Input.GetKey(KeyCode.R)) { ScoreSaver.SetData(); //Time.timeScale = 1; if (!bultcontrol.fourPlayerMode) { Application.LoadLevel("MainScene"); } else { Application.LoadLevel("DoubleMainScene"); } } if (Time.timeSinceLevelLoad - timeOfEnding > 5) { if (playerInputScript.pilloPressure1 >= 0.5f || playerInputScript.pilloPressure2 >= 0.5f) { ScoreSaver.SetData(); //Time.timeScale = 1; if (!bultcontrol.fourPlayerMode) { Application.LoadLevel("MainScene"); } else { Application.LoadLevel("DoubleMainScene"); } } } } }
void OnGUI() { if (!showScores) { GUI.Label(new Rect(0, -5, 220, 160), scoreLabel); GUI.Label(new Rect(Screen.width - 220, -5, 220, 160), timeLabel); GUI.Label(new Rect(40, 60, 100, 50), "" + score, styleNormal); GUI.Label(new Rect(Screen.width - 105, 60, 100, 50), text, styleNormal); if (timeToDeath < 20) { // GUI.Label (new Rect (Screen.width * 0.42f, Screen.height * 0.8f, Screen.width * 0.2f, Screen.height * 0.2f), Sys.Math.Round(timeToDeath,2).ToString(),styleMiddle); GUI.Label(new Rect(Screen.width * 0.42f, Screen.height * 0.8f, Screen.width * 0.2f, Screen.height * 0.2f), text, styleMiddle); } } else { GUI.Label(new Rect(Screen.width / 2 - 275, 40, 600, 550), scoreScreen); GUILayout.BeginArea(new Rect(Screen.width / 2 - 50, 200, 600, 550)); GUILayout.BeginVertical(); bool highscoreFound = false; foreach (var nam in ScoreSaver.pScorings) { //if(nam.Length > 1){ //GUILayout.Box(nam); //Debug.Log(highScore); //Debug.Log(nam); if (nam != null) { if (((string)nam).Equals(highScore.ToString()) && !highscoreFound) { GUILayout.Box(nam, styleOwnScore); highscoreFound = true; } else { GUILayout.Box(nam, styleNormal); } } //} } GUILayout.EndVertical(); GUILayout.EndArea(); if (GUI.Button(new Rect(Screen.width * 0.75f, Screen.height * 0.8f, Screen.width * 0.25f, Screen.height * 0.20f), "", quitBtn)) { ScoreSaver.SetData(); //Time.timeScale = 1; Application.LoadLevel("WelkomScene"); } if (GUI.Button(new Rect(0, Screen.height * 0.8f, Screen.width * 0.25f, Screen.height * 0.20f), "", playBtn)) { ScoreSaver.SetData(); //Time.timeScale = 1; if (!bultcontrol.fourPlayerMode) { Application.LoadLevel("MainScene"); } else { Application.LoadLevel("DoubleMainScene"); } } } }