Exemplo n.º 1
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();
            }
        }
    }