コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        IVRHandlerInputModule inputModule = EventSystem.current.currentInputModule
                                            as IVRHandlerInputModule;
        IVRInputModule test = EventSystem.current.currentInputModule as IVRInputModule;

        //Debug.Log(test);
        if (inputModule != null)
        {
            TouchPad.color = IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_TP_CLICK) ?
                             ClickColor : Color.white;
            HomeButton.color = IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_HOME) ?
                               ClickColor : Color.white;
            AppButton.color = IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_APP) ?
                              ClickColor : Color.white;
            MinusButton.color = IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_VOL_DOWN) ?
                                ClickColor : Color.white;
            AddButton.color = IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_VOL_UP) ?
                              ClickColor : Color.white;
            TriggerButton.color = IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_TRIGGER) ? ClickColor : Color.white;
            if (IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_HOME))
            {
                IVR.IVRInputHandler.SendVibrateCmd(1);
            }
            if (IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_APP))
            {
                IVR.IVRInputHandler.SendVibrateCmd(2);
            }
            if (IVR.IVRInputHandler.GetKey(IVR.ControllerButton.CONTROLLER_BUTTON_TP_CLICK))
            {
                IVR.IVRInputHandler.SendVibrateCmd(3);
            }
        }
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        startforward       = transform.forward;
        startright         = transform.right;
        startup            = transform.up;
        startworldpos      = transform.position;
        mDynamicMat        = mRender.material;
        module             = GameObject.FindObjectOfType <IVRInputModule>();
        mInitLocalPosition = transform.localPosition;
        mInitLocalScal     = transform.localScale;
        Depth   = Mathf.Abs(mInitLocalPosition.z);
        started = true;
        IVRManager.OnResetPos += IVRManager_OnResetPos;
        mShaderClipID          = Shader.PropertyToID("_Offset");

        MaxAngleX = Vector3.Angle(transform.parent.position - transform.position,
                                  transform.parent.position - (transform.position + transform.right * (Width / 2 - transform.localScale.x)));
        MaxAngleY = Vector3.Angle(transform.parent.position - transform.position,
                                  transform.parent.position - (transform.position + transform.up * (Height / 2 - transform.localScale.y)));
        LengthAngle = Vector3.Angle(transform.parent.position - (transform.position + transform.up * transform.localScale.y / 2),
                                    transform.parent.position - (transform.position - transform.up * transform.localScale.y / 2));
    }