예제 #1
0
    private void OnGUI()
    {
        GUI.skin = skin;
        GUI.Box(new Rect(Screen.width * menuCoordX, Screen.height * menuCoordY, Screen.width * menuWidth, Screen.height * menuHeight), "");

        if (mainMenu)
        {
            if (GUI.Button(new Rect(Screen.width * allButtonsPosX, Screen.height * firstButtonPosY, Screen.width * buttonWidth, Screen.height * buttonHeight), new GUIContent("Play", "Play")))
            {
                mainMenu = false;
                play     = true;
                soundsManager.PlayButtonClick();
                Application.LoadLevel("MainScene");
            }
            if (GUI.Button(new Rect(Screen.width * allButtonsPosX, Screen.height * secondButtonPosY, Screen.width * buttonWidth, Screen.height * buttonHeight), new GUIContent("HighScore", "HighScore")))
            {
                mainMenu   = false;
                highScores = true;
                soundsManager.PlayButtonClick();
            }
            if (GUI.Button(new Rect(Screen.width * allButtonsPosX, Screen.height * thirdButtonPosY, Screen.width * buttonWidth, Screen.height * buttonHeight), new GUIContent("Controls", "Controls")))
            {
                mainMenu = false;
                controls = true;
                soundsManager.PlayButtonClick();
            }
        }
        else if (highScores)
        {
            _highScore = PlayerPrefs.GetInt(HIGHSCORE);
            GUI.Label(new Rect(Screen.width * allButtonsPosX, Screen.height * firstButtonPosY, Screen.width * buttonWidth, Screen.height * 3 * buttonHeight),
                      "Current highscore\n" +
                      " is\n" +
                      _highScore);
            if (GUI.Button(new Rect(Screen.width * allButtonsPosX, Screen.height * thirdButtonPosY, Screen.width * buttonWidth, Screen.height * buttonHeight), new GUIContent("Return", "Return")))
            {
                mainMenu   = true;
                highScores = false;
                soundsManager.PlayButtonClick();
            }
        }
        else if (controls)
        {
            if (GUI.Button(new Rect(Screen.width * allButtonsPosX, Screen.height * thirdButtonPosY, Screen.width * buttonWidth, Screen.height * buttonHeight), new GUIContent("Return", "Return")))
            {
                mainMenu = true;
                controls = false;
                soundsManager.PlayButtonClick();
            }
            GUI.Label(new Rect(Screen.width * allButtonsPosX, Screen.height * firstButtonPosY, Screen.width * buttonWidth, Screen.height * 3 * buttonHeight),
                      "New Life : R\n" +
                      "Flipper Left : F\n" +
                      "Flipper Right : J\n" +
                      "Launch Ball : Space\n" +
                      "Pause Game : P");
        }
    }
예제 #2
0
 private void OnGUI()
 {
     if (isGamePaused)
     {
         GUI.skin = skin;
         GUI.Box(new Rect(Screen.width * menuCoordX, Screen.height * menuCoordY, Screen.width * menuWidth, Screen.height * menuHeight), "Pause");
         if (GUI.Button(new Rect(Screen.width * allButtonsPosX, Screen.height * firstButtonPosY, Screen.width * buttonWidth, Screen.height * buttonHeight), new GUIContent("Resume", "Resume")))
         {
             soundsManager.PlayButtonClick();
             Time.timeScale = 1;
             isGamePaused   = false;
         }
         if (GUI.Button(new Rect(Screen.width * allButtonsPosX, Screen.height * secondButtonPosY, Screen.width * buttonWidth, Screen.height * buttonHeight), new GUIContent("Menu", "Menu")))
         {
             soundsManager.PlayButtonClick();
             Time.timeScale = 1;
             Application.LoadLevel("Menu");
         }
     }
 }