Пример #1
0
 private void Update()
 {
     if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_DPAD_CENTER) ||
         NxrInput.GetControllerKeyDown(CKeyEvent.KEYCODE_CONTROLLER_TOUCHPAD))
     {
         OnGazeTrigger();
     }
 }
Пример #2
0
 private void Update()
 {
     if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_BACK) ||
         NxrInput.GetControllerKeyUp(CKeyEvent.KEYCODE_CONTROLLER_MENU) ||
         NxrInput.GetControllerKeyUp(CKeyEvent.KEYCODE_CONTROLLER_MENU,
                                     InteractionManager.NACTION_HAND_TYPE.HAND_LEFT) ||
         NxrInput.GetControllerKeyUp(CKeyEvent.KEYCODE_CONTROLLER_MENU,
                                     InteractionManager.NACTION_HAND_TYPE.HAND_RIGHT))
     {
         // 返回键
         Debug.Log("Update->OnGazeTrigger");
         OnGazeTrigger();
     }
 }
Пример #3
0
        // Update is called once per frame
        void Update()
        {
            bool IsTouchpadTouched = false;

            if (NxrInput.GetControllerKeyPressed(CKeyEvent.KEYCODE_CONTROLLER_TOUCHPAD_TOUCH) ||
                NxrInput.GetControllerKeyPressed(CKeyEvent.KEYCODE_CONTROLLER_TOUCHPAD_TOUCH, InteractionManager.NACTION_HAND_TYPE.HAND_LEFT) ||
                NxrInput.GetControllerKeyPressed(CKeyEvent.KEYCODE_CONTROLLER_TOUCHPAD_TOUCH, InteractionManager.NACTION_HAND_TYPE.HAND_RIGHT))
            {
                IsTouchpadTouched = true;
            }

            if (sphere != null)
            {
                if (IsTouchpadTouched)
                {
                    Vector2 pos = InteractionManager.TouchPadPosition;
                    sphere.transform.localPosition = sphereInitPos + new Vector3(pos.x / 2, -pos.y / 2, 0);
                }
                else
                {
                    sphere.transform.localPosition = sphereInitPos;
                }
            }
        }
Пример #4
0
        // Update is called once per frame
        void Update()
        {
            //GameObject controllerDot = NibiruAxis.NxrPlayerCtrl.Instance.GetControllerLaserDot();
            //if (controllerDot != null)
            //{
            //    Debug.Log("Contoller Dot:" + controllerDot.transform.position.ToString());
            //}
            //NxrReticle reticle = NxrViewer.Instance.GetNxrReticle();
            //if (reticle.IsShowing())
            //{
            //    Debug.Log("Reticle:" + reticle.GetReticlePointer().transform.position.ToString());
            //}

            if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_DPAD_CENTER))
            {
                textMesh.text = "HMD Enter : Down";
            }

            if (NxrInput.GetKeyPressed(CKeyEvent.KEYCODE_DPAD_CENTER))
            {
                textMesh.text = "HMD Enter : Pressed";
            }

            if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_DPAD_CENTER))
            {
                textMesh.text = "HMD Enter  : Up";
            }

            if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_BACK))
            {
                textMesh.text = "HMD Back : Down";
            }

            if (NxrInput.GetKeyPressed(CKeyEvent.KEYCODE_BACK))
            {
                textMesh.text = "HMD Back : Pressed";
            }

            if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_BACK))
            {
                textMesh.text = "HMD Back : Up";
            }

            if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_DPAD_LEFT))
            {
                textMesh.text = "HMD Left : Down";
            }

            if (NxrInput.GetKeyPressed(CKeyEvent.KEYCODE_DPAD_LEFT))
            {
                textMesh.text = "HMD Left : Pressed";
            }

            if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_DPAD_LEFT))
            {
                textMesh.text = "HMD Left : Up";
            }

            if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_DPAD_RIGHT))
            {
                textMesh.text = "HMD Right : Down";
            }

            if (NxrInput.GetKeyPressed(CKeyEvent.KEYCODE_DPAD_RIGHT))
            {
                textMesh.text = "HMD Right : Pressed";
            }

            if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_DPAD_RIGHT))
            {
                textMesh.text = "HMD Right : Up";
            }

            if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_DPAD_UP))
            {
                textMesh.text = "HMD Up : Down";
            }

            if (NxrInput.GetKeyPressed(CKeyEvent.KEYCODE_DPAD_UP))
            {
                textMesh.text = "HMD Up : Pressed";
            }

            if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_DPAD_UP))
            {
                textMesh.text = "HMD Up : Up";
            }

            if (NxrInput.GetKeyDown(CKeyEvent.KEYCODE_DPAD_DOWN))
            {
                textMesh.text = "HMD Down : Down";
            }

            if (NxrInput.GetKeyPressed(CKeyEvent.KEYCODE_DPAD_DOWN))
            {
                textMesh.text = "HMD Down : Pressed";
            }

            if (NxrInput.GetKeyUp(CKeyEvent.KEYCODE_DPAD_DOWN))
            {
                textMesh.text = "HMD Down : Up";
            }

            // 3DOF Controller
            if (InteractionManager.Is3DofControllerConnected())
            {
                InteractionManager.NACTION_HAND_TYPE mHandType = InteractionManager.GetHandTypeByHandMode();
                TextMesh textMeshController = textMeshControllerRight;
                if (mHandType == InteractionManager.NACTION_HAND_TYPE.HAND_LEFT)
                {
                    textMeshController = textMeshControllerLeft;
                }

                bool HasKeyDown = false;
                for (int i = 0, size = threeDofCtrlKeyCode.Length; i < size; i++)
                {
                    int    keyCode = threeDofCtrlKeyCode[i];
                    string keyStr  = threeDofCtrlKeyStr[i];
                    if (NxrInput.GetControllerKeyDown(keyCode))
                    {
                        textMeshController.text = keyStr + "Down_" + mHandType.ToString();
                        HasKeyDown = true;
                    }

                    if (!HasKeyDown && NxrInput.GetControllerKeyPressed(keyCode))
                    {
                        textMeshController.text = keyStr + "Pressed_" + mHandType.ToString();
                        HasKeyDown = true;
                    }

                    if (!HasKeyDown)
                    {
                        if (NxrInput.GetControllerKeyUp(keyCode))
                        {
                            textMeshController.text = keyStr + "Up_" + mHandType.ToString();
                        }
                    }
                }
            }
            else
            {
                // SixDof Controller
                foreach (InteractionManager.NACTION_HAND_TYPE HandType in handTypes)
                {
                    TextMesh textMeshCtrl = null;
                    if (HandType == InteractionManager.NACTION_HAND_TYPE.HAND_LEFT)
                    {
                        textMeshCtrl = textMeshControllerLeft;
                    }
                    else
                    {
                        textMeshCtrl = textMeshControllerRight;
                    }

                    bool HasKeyDown = false;
                    for (int i = 0, size = sixDofCtrlKeyCode.Length; i < size; i++)
                    {
                        int    keyCode = sixDofCtrlKeyCode[i];
                        string keyStr  = sixDofCtrlKeyStr[i];
                        if (NxrInput.GetControllerKeyDown(keyCode, HandType))
                        {
                            textMeshCtrl.text = keyStr + "Down_" + HandType.ToString();
                            HasKeyDown        = true;
                        }

                        if (!HasKeyDown && NxrInput.GetControllerKeyPressed(keyCode, HandType))
                        {
                            textMeshCtrl.text = keyStr + "Pressed_" + HandType.ToString();
                            HasKeyDown        = true;
                        }

                        if (!HasKeyDown)
                        {
                            if (NxrInput.GetControllerKeyUp(keyCode, HandType))
                            {
                                textMeshCtrl.text = keyStr + "Up_" + HandType.ToString();
                            }
                        }
                    }
                }
            }
        }