コード例 #1
0
    private void Update()
    {
        if (VRInput.GetControlDown(handType, Controls.Menu))
        {
            StartTeleport();
        }
        if (VRInput.GetControlUp(handType, Controls.Menu))
        {
            EndTeleport();
        }

        if (isTeleporting)
        {
            DrawLine();
        }
    }
コード例 #2
0
    public void Update(float deltaTime)
    {
        if (VRInput.GetControl(handType, ControlType.PadTouch))
        {
            if (VRInput.GetControlDown(handType, ControlType.PadTouch))
            {
                isSwiping = true;
                timeout   = pipelineManager.New().Delay(timeoutSec).Func(Reset);
                return;
            }

            if (isSwiping)
            {
                Vector2 delta = VRInput.PadTouchDelta(handType);
                deltaX += delta.x;
                deltaY += delta.y;
            }
        }

        if (VRInput.GetControlUp(handType, ControlType.PadTouch))
        {
            if (isSwiping)
            {
                if (deltaX > swipeThreshold)
                {
                    OnSwipeRight?.Invoke(deltaX);
                }
                else if (deltaX < -swipeThreshold)
                {
                    OnSwipeLeft?.Invoke(deltaX);
                }

                if (deltaY > swipeThreshold)
                {
                    OnSwipeUp?.Invoke(deltaX);
                }
                else if (deltaY < -swipeThreshold)
                {
                    OnSwipeDown?.Invoke(deltaX);
                }

                Reset();
            }
        }
    }
コード例 #3
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;
        }
    }