Наследование: UnityEngine.MonoBehaviour
Пример #1
0
 public static void DeregisterInteractable(VRIInteractable interactable)
 {
     for (int index = 0; index < Instance.Hands.Length; index++)
     {
         Instance.Hands[index].DeregisterInteractable(interactable);
     }
 }
Пример #2
0
        public static void Deregister(VRIInteractable interactable)
        {
            VRIPlayer.DeregisterInteractable(interactable);

            ColliderMapping = ColliderMapping.Where(mapping => mapping.Value != interactable).ToDictionary(mapping => mapping.Key, mapping => mapping.Value);
            VRIInteractableMapping.Remove(interactable);
        }
Пример #3
0
 public static void DeregisterInteractable(VRIInteractable interactable)
 {
     for (int index = 0; index < Instance.Hands.Length; index++)
     {
         Instance.Hands[index].DeregisterInteractable(interactable);
     }
 }
        public static void Deregister(VRIInteractable interactable)
        {
            VRIPlayer.DeregisterInteractable(interactable);

            ColliderMapping = ColliderMapping.Where(mapping => mapping.Value != interactable).ToDictionary(mapping => mapping.Key, mapping => mapping.Value);
            VRIInteractableMapping.Remove(interactable);
        }
Пример #5
0
        public void DeregisterInteractable(VRIInteractable interactable)
        {
            if (CurrentlyInteracting == interactable)
                CurrentlyInteracting = null;

            CurrentlyHoveringOver.Remove(interactable);
        }
Пример #6
0
        private void PickupClosest()
        {
            VRIInteractable closest         = null;
            float           closestDistance = float.MaxValue;

            foreach (var hovering in CurrentlyHoveringOver)
            {
                if (hovering.Key == null)
                {
                    continue;
                }

                float distance = Vector3.Distance(this.transform.position, hovering.Key.transform.position);
                if (distance < closestDistance)
                {
                    closestDistance = distance;
                    closest         = hovering.Key;
                }
            }

            if (closest != null)
            {
                BeginInteraction(closest);
            }
        }
Пример #7
0
        public static void Register(VRIInteractable interactable, Collider[] colliders)
        {
            VRIInteractableMapping.Add(interactable, colliders);

            for (int index = 0; index < colliders.Length; index++)
            {
                ColliderMapping.Add(colliders[index], interactable);
            }
        }
        public static void Register(VRIInteractable interactable, Collider[] colliders)
        {
            VRIInteractableMapping.Add(interactable, colliders);

            for (int index = 0; index < colliders.Length; index++)
            {
                ColliderMapping.Add(colliders[index], interactable);
            }
        }
Пример #9
0
        public void DeregisterInteractable(VRIInteractable interactable)
        {
            if (CurrentlyInteracting == interactable)
            {
                CurrentlyInteracting = null;
            }

            CurrentlyHoveringOver.Remove(interactable);
        }
Пример #10
0
        public void EndInteraction(VRIInteractable item)
        {
            if (item != null && CurrentlyHoveringOver.ContainsKey(item) == true)
            {
                CurrentlyHoveringOver.Remove(item);
            }

            if (CurrentlyInteracting != null)
            {
                CurrentlyInteracting.EndInteraction();
                CurrentlyInteracting = null;
            }
        }
Пример #11
0
        private void BeginInteraction(VRIInteractable interactable)
        {
            if (interactable.CanAttached == true)
            {
                if (interactable.AttachedHand != null)
                {
                    interactable.AttachedHand.EndInteraction(null);
                }

                CurrentlyInteracting = interactable;
                CurrentlyInteracting.BeginInteraction(this);
            }
        }
Пример #12
0
        private void OnTriggerExit(Collider collider)
        {
            VRIInteractable interactable = VRIInteractables.GetInteractable(collider);

            if (interactable == null)
            {
                return;
            }

            if (CurrentlyHoveringOver.ContainsKey(interactable) == true)
            {
                if (CurrentlyHoveringOver[interactable].ContainsKey(collider) == true)
                {
                    CurrentlyHoveringOver[interactable].Remove(collider);
                }
            }
        }
Пример #13
0
        private void OnTriggerStay(Collider collider)
        {
            VRIInteractable interactable = VRIInteractables.GetInteractable(collider);

            if (interactable == null)
            {
                return;
            }

            if (CurrentlyHoveringOver.ContainsKey(interactable) == false)
            {
                CurrentlyHoveringOver[interactable] = new Dictionary <Collider, float>();
            }

            if (CurrentlyHoveringOver[interactable].ContainsKey(collider) == false)
            {
                CurrentlyHoveringOver[interactable][collider] = Time.time;
            }
        }
Пример #14
0
        public void EndInteraction(VRIInteractable item)
        {
            if (item != null && CurrentlyHoveringOver.ContainsKey(item) == true)
                CurrentlyHoveringOver.Remove(item);

            if (CurrentlyInteracting != null)
            {
                CurrentlyInteracting.EndInteraction();
                CurrentlyInteracting = null;
            }
        }
Пример #15
0
        private void BeginInteraction(VRIInteractable interactable)
        {
            if (interactable.CanAttached == true)
            {
                if (interactable.AttachedHand != null)
                {
                    interactable.AttachedHand.EndInteraction(null);
                }

                CurrentlyInteracting = interactable;
                CurrentlyInteracting.BeginInteraction(this);
            }
        }