private void Exit(XRPhysicsInteractor interactor, XRInteractionEventReceiver receiver)
 {
     if (interactor.ButtonHeldCount == 0 || !_interactionEventReceiver.enabled)
     {
         _states[InteractorToChiralityIndex(interactor)] = HoverState.Empty;
     }
 }
        public virtual void OnEnter(XRPhysicsInteractor interactor)
        {
            _hoveringInteractors.Add(interactor);
            if (_hoveringInteractors.Count == 1 && _hoveringCoroutine == null)
            {
                _hoveringCoroutine = StartCoroutine(HoveringCoroutine());
                OnFirstEnter(interactor);
            }

            _events.Enter.Invoke(interactor, this);
        }
 private void Enter(XRPhysicsInteractor interactor, XRInteractionEventReceiver receiver)
 {
     if (interactor.ButtonHeldCount > 0)
     {
         _states[InteractorToChiralityIndex(interactor)] = HoverState.Press;
     }
     else
     {
         _states[InteractorToChiralityIndex(interactor)] = HoverState.Hover;
     }
 }
示例#4
0
        public void SetInteractorState <T>(bool state) where T : XRInteractor
        {
            if (typeof(T) == typeof(XRUnityUILaserInteractor))
            {
                UnityUIInteractor.gameObject.SetActive(state);
            }

            XRPhysicsInteractor interactor = _physicsInteractors.Find(i => i is T);

            if (null != interactor)
            {
                interactor.gameObject.SetActive(state);
            }
        }
示例#5
0
        public XRButtonDatum(XRUserController parentUserController, XRPhysicsInteractor parentInteractor, XRInputName inputName)
        {
            ParentUserController = parentUserController;
            ParentInteractor     = parentInteractor;
            InputName            = inputName;

            _pressLocalTransform = new GameObject("PressLocalTransform").transform;
            _pressLocalTransform.gameObject.hideFlags = HideFlags.HideAndDontSave;
            _pressLocalTransform.SetParent(parentInteractor.transform);

            _pressLocalHitTransform = new GameObject("PressLocalHitTransform").transform;
            _pressLocalHitTransform.gameObject.hideFlags = HideFlags.HideAndDontSave;
            _pressLocalHitTransform.SetParent(parentInteractor.transform);
        }
        private void SetHighlightPositions(int index)
        {
            XRPhysicsInteractor interactor = _interactionEventReceiver.GetHoveringInteractor((Chirality)index + 1);
            XRButtonDatum       datum      = _interactionEventReceiver.GetHeldButton((Chirality)index + 1);

            if (null != datum)
            {
                _highlightMaterial.SetVector(
                    HighlightPropertyNames[index],
                    datum.RayHitChildedToPressGameObject.origin);
            }
            else if (null != interactor)
            {
                _highlightMaterial.SetVector(
                    HighlightPropertyNames[index],
                    interactor.CurrentSourceRay.origin);
            }
        }
        public virtual void OnExit(XRPhysicsInteractor interactor)
        {
            _hoveringInteractors.Remove(interactor);
            if (_hoveringInteractors.Count == 0 && _heldButtons.Count == 0)
            {
                if (null != _hoveringCoroutine)
                {
                    StopCoroutine(_hoveringCoroutine);
                }
                _hoveringCoroutine = null;
            }

            if (_hoveringInteractors.Count == 0)
            {
                OnLastExit(interactor);
            }

            _events.Exit.Invoke(interactor, this);
        }
 public virtual void OnLastExit(XRPhysicsInteractor interactor)
 {
     _events.LastExit.Invoke(interactor, this);
 }
 public virtual void OnStay(XRPhysicsInteractor interactor)
 {
     _events.Stay.Invoke(interactor, this);
 }
 public virtual void OnFirstEnter(XRPhysicsInteractor interactor)
 {
     _events.FirstEnter.Invoke(interactor, this);
 }