コード例 #1
0
    private void UpdateNew(float deltaTime)
    {
        Vector2 touch = VRInput.PadTouchValue(handType);
        float   x     = touch.x;
        float   y     = touch.y;

        if (VRInput.GetControlDown(handType, ControlType.DPadCenter))
        {
            OnClickMiddle?.Invoke(x, y);
            return;
        }

        if (VRInput.GetControlDown(handType, ControlType.DPadNorth))
        {
            OnClickUp?.Invoke(x, y);
        }
        else if (VRInput.GetControlDown(handType, ControlType.DPadSouth))
        {
            OnClickDown?.Invoke(x, y);
        }
        if (VRInput.GetControlDown(handType, ControlType.DPadWest))
        {
            OnClickLeft?.Invoke(x, y);
        }
        else if (VRInput.GetControlDown(handType, ControlType.DPadEast))
        {
            OnClickRight?.Invoke(x, y);
        }
    }
コード例 #2
0
    private void UpdateOld(float deltaTime)
    {
        if (VRInput.GetControlDown(handType, ControlType.PadClick))
        {
            Vector2 touch = VRInput.PadTouchValue(handType);
            float   x     = touch.x;
            float   y     = touch.y;

            float distSqrd = x * x + y * y;
            if (distSqrd < middleRadiusSqrd)
            {
                TouchMiddle(x, y);
                return;
            }

            if (touch.x < 0)
            {
                TouchLeft(x, y);
            }
            else if (touch.x > 0)
            {
                TouchRight(x, y);
            }
            if (touch.y < 0)
            {
                TouchDown(x, y);
            }
            else if (touch.y > 0)
            {
                TouchUp(x, y);
            }

            IsDown = true;
        }

        if (VRInput.GetControlUp(handType, ControlType.PadClick))
        {
            IsDown = false;
        }
    }
コード例 #3
0
    private void UpdateIndex(Hand hand)
    {
        if (VRInput.GetControlDown(hand.HandType, ControlType.PadTouch))
        {
            touch = true;
        }

        if (!touch)
        {
            return;
        }

        if (VRInput.GetControl(hand.HandType, ControlType.PadTouch))
        {
            int swipe = SwipeDirection(VRInput.PadTouchValue(hand.HandType), VRInput.PadTouchDelta(hand.HandType));
            if (swipe != 0)
            {
                currentIndex += swipe;
                recent        = false;
            }
        }
    }