示例#1
0
    void OnGUI()
    {
        float width  = Screen.width / 10;
        float height = Screen.height / 12;

        if (GUI.Button(new Rect(0, 0, width, height), "Start"))
        {
            action.GameStart();
        }
        string mode = "";

        if (action.GetMode())
        {
            if (GUI.Button(new Rect(0, height, width, height), "ChangeMode"))
            {
                action.UseKin();
            }
            mode = "Physis";
        }
        else
        {
            if (GUI.Button(new Rect(0, height, width, height), "ChangeMode"))
            {
                action.UsePhy();
            }
            mode = "Kinematic";
        }
        GUI.TextArea(new Rect(0, height * 2, width, height), "Mode: " + mode);
        if (action.GetStatus())
        {
            GUI.Window(0, new Rect(Screen.width / 2 - 100, Screen.height / 2 - 50, 200, 70), Restart, "Game Result\n" + "Your Record is " + action.GetRecord().ToString());
        }
        GUI.TextArea(new Rect(0, height * 3, width, height), "Record: " + action.GetRecord().ToString());
    }
示例#2
0
 void OnGUI()
 {
     ScoreText.text = "Score: " + score.getScore().ToString();
     GUI.Label(new Rect(4 * Screen.width / 5, 2 * Screen.height / 5, Screen.width / 8, Screen.height / 2), "巡逻兵在设定范围内感知到玩家,会自动追击玩家计分:玩家每次甩掉一个巡逻兵计一分,与巡逻兵碰撞游戏结束;");
     if (!actions.GameStart())
     {
         if (GUI.Button(new Rect(4 * Screen.width / 5, Screen.height / 5, Screen.width / 9, Screen.width / 16), "Start"))
         {
             actions.StartGame();
         }
     }
     if (actions.GameOver() && actions.GameStart())
     {
         if (GUI.Button(new Rect(4 * Screen.width / 5, Screen.height / 5, Screen.width / 9, Screen.width / 16), "Restart"))
         {
             actions.Restart();
         }
     }
 }
 void OnGUI()
 {
     GUI.Label(new Rect(20, 20, 120, 25), "score: " + scoreCtrl.getScore());
     if (state == STATE.STOP)
     {
         if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 25, 100, 50), "Start", style2))
         {
             action.Reset();
             scoreCtrl.reset();
             action.GameStart();
             state = STATE.RUNNING;
         }
     }
 }
 void OnGUI()
 {
     if (action.getState() == 0)
     {
         GUI.Label(new Rect(20, 20, 120, 25), "score: " + ((FirstController)SSDirector.GetInstance().CurrentSceneController).scoreCtrl.score, style1);
         return;
     }
     if (action.getState() == 1)
     {
         if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 25, 100, 50), "Start", style2))
         {
             action.Reset();
             action.GameStart();
         }
     }
 }