Exemplo n.º 1
0
        /// <summary>
        /// Attempts to nock the arrow.
        /// </summary>
        /// <param name="data">The collision data which should contain an arrow.</param>
        public virtual void AttemptArrowNock(CollisionNotifier.EventData data)
        {
            if (ArrowSnapZone.SnappedGameObject != null || !data.ColliderData.name.Equals("ArrowNockPoint"))
            {
                return;
            }

            InteractableFacade arrow = data.ColliderData.GetAttachedRigidbody().GetComponent <InteractableFacade>();

            if (arrow == null || arrow.GrabbingInteractors.Count == 0)
            {
                return;
            }

            arrowInteractor = arrow.GrabbingInteractors.Count > 0 ? arrow.GrabbingInteractors[0] : null;

            if (arrowInteractor == null)
            {
                return;
            }

            arrowInteractor.Ungrab();
            arrowInteractor.SimulateUntouch(arrow);
            arrowInteractor.Grab(BowInteractable);
            ArrowSnapZone.Snap(arrow);

            nockedArrow = arrow.GetComponentInParent <ArrowController>();
            ToggleColliders(BowColliders, nockedArrow.ArrowColliders, true);
            nockedArrow.ToggleColliderTrigger(true);
        }
        /// <summary>
        /// Attempts to ungrab the Interactable.
        /// </summary>
        /// <param name="interactor">The Interactor to ungrab from.</param>
        public virtual void Ungrab(InteractorFacade interactor)
        {
            if (interactor == null)
            {
                return;
            }

            interactor.Ungrab();

            //If the ungrab hasn't happened for some reason, then let's check to see if the interactor is still grabbing and force a stop grab.
            if (GrabbingInteractors.Contains(interactor))
            {
                GrabReceiver.UngrabConsumer.Consume(interactor.GrabConfiguration.StopGrabbingPublisher.Payload, null);
            }
        }
 /// <summary>
 /// Attempts to ungrab the Interactable.
 /// </summary>
 /// <param name="interactor">The Interactor to ungrab from.</param>
 public virtual void Ungrab(InteractorFacade interactor)
 {
     interactor.Ungrab();
 }
 /// <summary>
 /// Attempts to ungrab the Interactable.
 /// </summary>
 /// <param name="interactor">The Interactor to ungrab from.</param>
 public virtual void Ungrab(InteractorFacade interactor)
 {
     interactor.Ungrab();
     //     print("ungrabbed");
 }
Exemplo n.º 5
0
 // Start is called before the first frame update
 public void ungrab()
 {
     LeftFacade.Ungrab();
     RightFacade.Ungrab();
 }