public virtual void ClearInteractorHover(XRBaseInteractor interactor, List <XRBaseInteractable> validTargets)
 {
     interactor.GetHoverTargets(m_HoverTargetList);
     foreach (var target in m_HoverTargetList)
     {
         if (!interactor.isHoverActive || !interactor.CanHover(target) || !target.IsHoverableBy(interactor) || ((validTargets != null && !validTargets.Contains(target)) || validTargets == null))
         {
             HoverExit(interactor, target);
         }
     }
 }
Beispiel #2
0
 void ClearInteractorHover(XRBaseInteractor interactor, List <XRBaseInteractable> validTargets)
 {
     interactor.GetHoverTargets(m_HoverTargetList);
     for (int i = 0; i < m_HoverTargetList.Count; i++)
     {
         var target = m_HoverTargetList[i];
         if (!interactor.isHoverActive || !interactor.CanHover(target) || !target.IsHoverableBy(interactor) || ((validTargets != null && !validTargets.Contains(target)) || validTargets == null))
         {
             HoverExit(interactor, target);
         }
     }
 }
 /// <summary>
 /// Automatically called each frame during Update to clear the hover state of the Interactor if necessary due to current conditions.
 /// </summary>
 /// <param name="interactor">The Interactor to potentially exit its hover state.</param>
 /// <param name="validTargets">The list of interactables that this Interactor could possibly interact with this frame.</param>
 public virtual void ClearInteractorHover(XRBaseInteractor interactor, List <XRBaseInteractable> validTargets)
 {
     interactor.GetHoverTargets(m_HoverTargetList);
     for (var i = m_HoverTargetList.Count - 1; i >= 0; --i)
     {
         var target = m_HoverTargetList[i];
         if (!interactor.isHoverActive || !interactor.CanHover(target) || !target.IsHoverableBy(interactor) || validTargets == null || !validTargets.Contains(target))
         {
             HoverExit(interactor, target);
         }
     }
 }
Beispiel #4
0
 void InteractorHoverValidTargets(XRBaseInteractor interactor, List <XRBaseInteractable> validTargets)
 {
     if (interactor.isHoverActive)
     {
         for (var i = 0; i < validTargets.Count && interactor.isHoverActive; ++i)
         {
             interactor.GetHoverTargets(m_HoverTargetList);
             if (interactor.CanHover(validTargets[i]) && validTargets[i].IsHoverableBy(interactor) &&
                 !m_HoverTargetList.Contains(validTargets[i]))
             {
                 HoverEnter(interactor, validTargets[i]);
             }
         }
     }
 }
Beispiel #5
0
        /// <summary>
        /// Automatically called each frame during Update to enter the hover state of the Interactor if necessary due to current conditions.
        /// </summary>
        /// <param name="interactor">The Interactor to potentially enter its hover state.</param>
        /// <param name="validTargets">The list of interactables that this Interactor could possibly interact with this frame.</param>
        protected virtual void InteractorHoverValidTargets(XRBaseInteractor interactor, List <XRBaseInteractable> validTargets)
        {
            if (!interactor.isHoverActive)
            {
                return;
            }

            for (var i = 0; i < validTargets.Count && interactor.isHoverActive; ++i)
            {
                var interactable = validTargets[i];
                if (interactor.CanHover(interactable) && interactable.IsHoverableBy(interactor))
                {
                    interactor.GetHoverTargets(m_HoverTargetList);
                    if (!m_HoverTargetList.Contains(interactable))
                    {
                        HoverEnter(interactor, interactable);
                    }
                }
            }
        }