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(); } } }
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; } } }