Пример #1
0
    void OnGUI()
    {
        if (!lastLevel)
        {
            if (GUI.Button(new Rect(0, 0, 140, 40), "Restart Level"))
            {
                GameObject.Find("LevelManager").SendMessage("RestartLevel");
            }

            /*if(GUI.Button(new Rect(0,70,140,40), "Next Level"))
             * {
             *      GameObject.Find("LevelManager").SendMessage("NextLevel");
             * }*/
            if (PlayerAI.getHp() == 3)
            {
                GUI.Box(new Rect(Screen.width - 100, 100, 100, 100), heart);
                GUI.Box(new Rect(Screen.width - 100, 200, 100, 100), heart);
                GUI.Box(new Rect(Screen.width - 100, 300, 100, 100), heart);
            }
            if (PlayerAI.getHp() == 2)
            {
                GUI.Box(new Rect(Screen.width - 100, 100, 100, 100), heart);
                GUI.Box(new Rect(Screen.width - 100, 200, 100, 100), heart);
                GUI.Box(new Rect(Screen.width - 100, 300, 100, 100), emptyHeart);
            }
            if (PlayerAI.getHp() == 1)
            {
                GUI.Box(new Rect(Screen.width - 100, 100, 100, 100), heart);
                GUI.Box(new Rect(Screen.width - 100, 200, 100, 100), emptyHeart);
                GUI.Box(new Rect(Screen.width - 100, 300, 100, 100), emptyHeart);
            }
            if (timerStart)
            {
                GUI.Box(new Rect(Screen.width - 100, 0.0f, 100.0f, 50.0f), "" + timer);
            }

            hSliderValue = GUI.HorizontalSlider(new Rect(0, Screen.height / 2, 100, 150), hSliderValue, 0.0f, 10.0f);
        }
        if (lastLevel)
        {
            if (!timerStart)
            {
                GUI.Box(new Rect(Screen.width / 2, Screen.height / 2 - 200, 300.0f, 50.0f), "Your Score: " + finalTime);
            }
        }
    }