コード例 #1
0
        protected virtual void UpdateState(DHUI_HoverEventArgs _hoverEvent)
        {
            if (ContactPlane_StaticPart.PointInFrontOfPlane(_hoverEvent.InteractorPosition))
            {
                if (hover_distance_staticPart < _hover_touchThreshold)
                {
                    ButtonInternalState = ButtonInternalStates.Touched;
                    m_interactionManager.HapticRetargeting?.HoldRetargeting();
                }
                else
                {
                    ButtonInternalState = ButtonInternalStates.Hovered;

                    m_interactionManager.HapticRetargeting?.UnholdRetargeting();
                }
            }
            else
            {
                if (currentActivationDistance >= _activationDistance_threshold)
                {
                    ButtonInternalState = ButtonInternalStates.Activated;
                }
                else
                {
                    ButtonInternalState = ButtonInternalStates.Pressed;
                }
            }
        }
コード例 #2
0
        protected virtual void UpdateHoverCalculations(DHUI_HoverEventArgs _hoverEvent)
        {
            Vector3 interactorPos = _hoverEvent.InteractorPosition;

            if (_lockDroneXYWhilePressed && (ButtonInternalState == ButtonInternalStates.Pressed || ButtonInternalState == ButtonInternalStates.Activated))
            {
                interactorPos = lastInteractorPos;
            }

            hover_distance_staticPart       = Mathf.Abs(ContactPlane_StaticPart.GetDistance(interactorPos));
            hover_projectedPoint_staticPart = ContactPlane_StaticPart.GetProjectedPoint(interactorPos);
            hover_distance_movingPart       = Mathf.Abs(ContactPlane_MovingPart.GetDistance(interactorPos));
            hover_projectedPoint_movingPart = ContactPlane_MovingPart.GetProjectedPoint(interactorPos);

            lastInteractorPos = interactorPos;
        }