예제 #1
0
 private void Update()
 {
     if (VRInput.GetControlDown(hand.HandType, Controls.Menu))
     {
         Move();
     }
 }
    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);
        }
    }
 private void Update()
 {
     if (VRInput.GetControlDown(type, Controls.DevEnv))
     {
         show = !show;
         RecursiveChildSearch(transform);
     }
 }
    private void Update()
    {
        if (VRInput.GetControlDown(handType, Controls.Menu))
        {
            StartTeleport();
        }
        if (VRInput.GetControlUp(handType, Controls.Menu))
        {
            EndTeleport();
        }

        if (isTeleporting)
        {
            DrawLine();
        }
    }
    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();
            }
        }
    }
예제 #6
0
    public override void OnGrab(Hand hand)
    {
        base.OnGrab(hand);

        bool takeMedicine = VRInput.GetControlDown(hand.HandType, Controls.TakeMedicine);
        bool sendMedicine = VRInput.GetControlDown(hand.HandType, Controls.EjectMedicine);

        int liquidAmount = 0;

        if (takeMedicine)
        {
            liquidAmount -= LiquidTransferStep;
        }
        if (sendMedicine)
        {
            liquidAmount += LiquidTransferStep;
        }
        if (liquidAmount == 0)
        {
            return;
        }

        if (this.HasSyringeCap)
        {
            Logger.Warning("Cannot change liquid amount of syringe with a cap");
            return;
        }

        if (State == InteractState.LuerlockAttached && Interactors.LuerlockPair.Value.ObjectCount == 2)
        {
            TransferToLuerlock(liquidAmount);
        }
        else if (State == InteractState.InBottle)
        {
            TransferToBottle(liquidAmount);
            Events.FireEvent(EventType.TakingMedicineFromBottle, CallbackData.Object(this));
        }
        else
        {
            Eject(liquidAmount);
        }
    }
    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;
        }
    }
    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;
            }
        }
    }