/// <summary>
        /// Attempt to grab an Interactable to the current Interactor utilising custom collision data.
        /// </summary>
        /// <param name="interactable">The Interactable to attempt to grab.</param>
        /// <param name="collision">Custom collision data.</param>
        /// <param name="collider">Custom collider data.</param>
        public virtual void Grab(InteractableFacade interactable, Collision collision, Collider collider)
        {
            if (interactable == null)
            {
                return;
            }

            Ungrab();
            startGrabbingPublisher.SetActiveCollisions(CreateActiveCollisionsEventData(interactable.gameObject, collision, collider));
            ProcessGrabAction(startGrabbingPublisher, true);
            if (interactable.grabType == InteractableFacade.ActiveType.Toggle)
            {
                ProcessGrabAction(startGrabbingPublisher, false);
            }
        }
Ejemplo n.º 2
0
        public void SetActiveCollisions()
        {
            ActiveCollisionsContainer.EventData eventData = new ActiveCollisionsContainer.EventData();
            GameObject oneContainer;

            CollisionNotifier.EventData oneData = CollisionNotifierHelper.GetEventData(out oneContainer);
            GameObject twoContainer;

            CollisionNotifier.EventData twoData = CollisionNotifierHelper.GetEventData(out twoContainer);
            eventData.ActiveCollisions.Add(oneData);
            eventData.ActiveCollisions.Add(twoData);

            Assert.AreEqual(0, subject.Payload.ActiveCollisions.Count);
            subject.SetActiveCollisions(eventData);
            Assert.AreEqual(2, subject.Payload.ActiveCollisions.Count);

            Object.DestroyImmediate(oneContainer);
            Object.DestroyImmediate(twoContainer);
        }