public void Update()
    {
        if (canvas.worldCamera == null)
        {
            TrinusUI.assignUICamera(canvas, trinusProcessor.getUICamera());
            if (trinusProcessor.shouldScaleUI())
            {
                transform.localScale = new Vector3(transform.localScale.x / 2, transform.localScale.y, transform.localScale.z);
            }
        }

        if (Input.GetButtonDown("Cancel"))           //in game mode, pause by pressing ESC
        {
            switch (state)
            {
            case STATE.GAME:
                pause(true);
                break;

            case STATE.PAUSE:
                pause(false);
                break;
            }
        }
        //when Trinus is running in VR mode, standard cursor won't work so we enable and update Trinus cursor
        if (state == STATE.PAUSE)
        {
            TrinusUI.updateTrinusCursor();
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (canvas != null && canvas.worldCamera == null)
        {
            TrinusUI.assignUICamera(canvas, trinusProcessor.getUICamera());
        }

        if (Input.GetButtonDown("Cancel"))           //in game mode, pause by pressing ESC
        //if (trinusUI.getCurrentPage() == TrinusUI.UI_PAGE.GAME)
        {
            switch (trinusUI.getCurrentPage())
            {
            case TrinusUI.UI_PAGE.GAME:
                Time.timeScale = 0;
                trinusUI.openSettings();
                break;

            case TrinusUI.UI_PAGE.SETTINGS:
                trinusEventSettingsFinished();
                break;

            case TrinusUI.UI_PAGE.CONNECTION_WAIT:
                trinusUI.restartConnection();
                break;
            }
        }
    }
Пример #3
0
 // Update is called once per frame
 void Update()
 {
     if (canvas.worldCamera == null)
     {
         TrinusUI.assignUICamera(canvas, trinusProcessor.getUICamera());
     }
     if (Input.GetButtonDown("Cancel"))           //in game mode, pause by pressing ESC
     {
         quit();
     }
 }
    public void Awake()
    {
        trinusProcessor = GameObject.Find("TrinusManager").GetComponent <TrinusProcessor> ();
        GameObject tc = GameObject.Find("TrinusUI");

        if (tc != null)
        {
            TrinusUI tui = tc.GetComponent <TrinusUI> ();
            //these can be set from the Editor, just putting them here for a quick set up
            tui.connectedEvent.AddListener(() => this.trinusEventConnected());               //we can display the game UI once Trinus is ready
            tui.disconnectedEvent.AddListener(() => this.trinusEventDisconnected());         //on disconnect, let's go back to main menu
            tui.finishedSettingsEvent.AddListener(() => this.trinusEventSettingsFinished()); //show the game pause settings UI when closing the Trinus settings UI
        }
        canvas = GetComponent <Canvas> ();

        transform.Find("InitialUI").gameObject.SetActive(true);
    }
 //your standard game pause
 public void pause(bool pause)
 {
     if (pause)
     {
         Time.timeScale = 0;
         transform.Find("PauseUI").gameObject.SetActive(true);
         state            = STATE.PAUSE;
         Cursor.lockState = CursorLockMode.None;
     }
     else
     {
         TrinusUI.setTrinusCursor(false);
         Time.timeScale = 1;
         transform.Find("PauseUI").gameObject.SetActive(false);
         state            = STATE.GAME;
         Cursor.lockState = CursorLockMode.Confined;
     }
 }
 void Awake()
 {
     trinusUI = GameObject.Find("TrinusUI").GetComponent <TrinusUI>();
     trinusUI.finishedSettingsEvent.AddListener(() => this.trinusEventSettingsFinished()); //show the game pause settings UI when closing the Trinus settings UI
     trinusUI.exitEvent.AddListener(() => this.quit());                                    //show the game pause settings UI when closing the Trinus settings UI
 }