Exemple #1
0
 // Start is called before the first frame update
 void Start()
 {
     arrived   = false;
     gameState = GameState.playing;
     action    = SceneDirector.GetInstance().CSController as ISceneController;
     action.LoadResources();
 }
Exemple #2
0
 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(1000, 50, 500, 500), "Score: " + UserActionController.GetScore().ToString() + "  Time:  " + ((int)(Time.time - S)).ToString() + "  Round:  " + round);
     if (!ss && GUI.Button(new Rect(Screen.width / 2 - 30, Screen.height / 2 - 30, 100, 50), "Start"))
     {
         S  = Time.time;
         ss = true;
         UserActionController.Restart();
         SceneController.LoadResources();
     }
     if (ss)
     {
         round = UserActionController.GetRound();
         if (Input.GetButtonDown("Fire1"))
         {
             Vector3 pos = Input.mousePosition;
             UserActionController.Hit(pos);
         }
         if (round > 3)
         {
             round = 3;
             if (UserActionController.RoundStop())
             {
                 ss = false;
             }
         }
     }
 }
Exemple #4
0
 // Start is called before the first frame update
 void Start()
 {
     clickGo   = false;
     arrived   = false;
     gameState = GameState.playing;
     action    = SceneDirector.GetInstance().CSController = new SceneController();
     action.LoadResources();
 }
Exemple #5
0
    void OnGUI()
    {
        GUIStyle button_style;

        button_style = new GUIStyle("button")
        {
            fontSize = 50
        };

        if (gameState == GameState.playing)
        {
            if (GUI.Button(new Rect(Screen.width / 2.1f, Screen.height / 8, 150, 70), "Go", button_style))
            {
                SceneDirector.GetInstance().CSController.MoveAll(out arrived);
            }
            if (GUI.Button(new Rect(Screen.width / 2.1f - 75, Screen.height / 4, 300, 70), "AI select", button_style))
            {
                SceneDirector.GetInstance().CSController.solverMove();
            }
        }
        else if (gameState == GameState.win)
        {
            if (GUI.Button(new Rect(Screen.width / 2.4f, Screen.height / 3.5f, 450, 170), "You Won \nplay again", button_style))
            {
                clickGo   = false;
                arrived   = false;
                gameState = GameState.playing;
                action.DestoryResources();
                action.LoadResources();
            }
        }
        else if (gameState == GameState.defeat)
        {
            if (GUI.Button(new Rect(Screen.width / 2.4f, Screen.height / 3.5f, 450, 170), "You Lost\nplay again", button_style))
            {
                clickGo   = false;
                arrived   = false;
                gameState = GameState.playing;
                action.DestoryResources();
                action.LoadResources();
            }
        }
    }
Exemple #6
0
    void OnGUI()
    {
        GUIStyle button_style = new GUIStyle("button");

        button_style.fontsize = 30;

        if (gameState == GameState.playing)
        {
            if (GUI.Button(new Rect(Screen.width / 2.1f, Screen.height / 8, 150, 70), "Go", button_style))
            {
                clickGo = true;
            }
        }
        else if (gameState == GameState.win)
        {
            if (GUI.Button(new Rect(Screen.width / 2.4f, Screen.height / 3.5f, 450, 170), "You Won \nplay again", button_style))
            {
                clickGo   = false;
                arrived   = false;
                gameState = GameState.playing;
                action.DestoryResources();
                action.LoadResources();
            }
        }
        else if (gameState == GameState.defeat)
        {
            if (GUI.Button(new Rect(Screen.width / 2.4f, Screen.height / 3.5f, 450, 170), "You Lost\nplay again", button_style))
            {
                clickGo   = false;
                arrived   = false;
                gameState = GameState.playing;
                action.DestoryResources();
                action.LoadResources();
            }
        }
    }
Exemple #7
0
    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();
            }
        }
    }
Exemple #8
0
 void OnGUI()
 {
     if (isStart == false)
     {
         if (GUI.Button(new Rect(200, 200, 240, 80), "Start Game"))
         {
             controller.LoadResources();
             isStart = true;
         }
     }
     else
     {
         if (isPause == true)
         {
             GUI.Label(new Rect(310, 400, 120, 20), "waiting!!!");
         }
         if (GUI.Button(new Rect(570, 5, 60, 20), "Resume"))
         {
             controller.Resume();
             isPause = false;
         }
         if (GUI.Button(new Rect(505, 5, 60, 20), "Pause"))
         {
             controller.Pause();
             isPause = true;
         }
         if (isPause == false)
         {
             if (GUI.Button(new Rect(5, 5, 100, 20), "Speed Up"))
             {
                 action.SpeedUp();
             }
             if (GUI.Button(new Rect(110, 5, 100, 20), "Speed Down"))
             {
                 action.SpeedDown();
             }
             if (GUI.Button(new Rect(215, 5, 100, 20), "Restart"))
             {
                 isStart = false; isPause = false;
                 action.GameOver();
             }
         }
     }
 }
 public void OnSceneWake(ISceneController controller)
 {
     currentSceneController = controller;
     controller.LoadResources();
 }