void Update()
 {
     if (Input.GetKey(KeyCode.I))
     {
         Move(Vector3.forward);
     }
     if (Input.GetKey(KeyCode.K))
     {
         Move(-Vector3.forward);
     }
     if (Input.GetKey(KeyCode.H))
     {
         Move(-Vector3.right);
     }
     if (Input.GetKey(KeyCode.L))
     {
         Move(Vector3.right);
     }
     if (Input.GetKey(KeyCode.U))
     {
         Move(Vector3.up);
     }
     if (Input.GetKey(KeyCode.J))
     {
         Move(-Vector3.up);
     }
     if (Input.GetKey(KeyCode.Y))
     {
         transform.Rotate(transform.up, -Time.deltaTime * 25);
     }
     if (Input.GetKey(KeyCode.O))
     {
         transform.Rotate(transform.up, Time.deltaTime * 25);
     }
     if (Input.GetKeyDown(KeyCode.Tab) && transform.parent)
     {
         transform.Rotate(transform.parent.up, 180, Space.World);
     }
     if (Input.GetKeyDown(KeyCode.Return))
     {
         var person = PlayerAvatar.getLocalPlayer()?.GetComponent <UnityStandardAssets.Characters.FirstPerson.FirstPersonController>();
         if (person)
         {
             person.m_DebugMode = !person.m_DebugMode;
         }
     }
 }
Exemple #2
0
    void UpdateState(GazeIO.State aState)
    {
        bool trackingChanged = aState.isTracking != _isTracking;

        _isTracking = aState.isTracking;

        // gaze ui and controls
        options.interactable        = !_isTracking && !aState.isBusy;
        calibrate.interactable      = !_isTracking && aState.isConnected && !aState.isBusy;
        toggleTracking.interactable = aState.isConnected && aState.isCalibrated && !aState.isBusy;
        toggleTracking.GetComponentInChildren <Text>().text = _isTracking ? "Stop" : "Start";
        gazeControls.SetActive(!_isTracking);

        State(this, new EventArgs());

        if (_isTracking && !_gameWasActvated)
        {
            ActivateGame();
        }

        if (trackingChanged)
        {
            // input module
            GetComponent <StandaloneInputModule>().enabled = !_isTracking;
            //GetComponent<GazeInput>().enabled = _isTracking;

            FirstPersonController fps = PlayerAvatar.getLocalPlayer()?.GetComponent <FirstPersonController>();
            if (fps != null)
            {
                fps.enabled = _isTracking;
            }

            if (_isTracking)
            {
                GameStart(this, new EventArgs());
            }
            else
            {
                GameStop(this, new EventArgs());
            }
        }
    }