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);
        }
Exemplo n.º 2
0
    public void GetTouch(PayloadData data)
    {
        if (hand.GrabbedObjects.Count > 0)
        {
            return;
        }

        if (data.ActiveCollisions != null && data.ActiveCollisions.Count > 0)
        {
            if (/*data.ActiveCollisions[0].ColliderData == last || */ !Value)
            {
                return;
            }

            var tempInteractible = data.ActiveCollisions[0].ColliderData.GetComponentInParent <InteractableFacade>();
            if (tempInteractible == null)
            {
                return;
            }

            hand.Grab(tempInteractible);

            lastValue = Value;
            //last = data.ActiveCollisions[0].ColliderData;
        }
    }
        /// <summary>
        /// Attempt to grab the Interactable to the given Interactor and ungrabs any existing grab.
        /// </summary>
        /// <param name="interactor">The Interactor to attach the Interactable to.</param>
        public virtual void Grab(InteractorFacade interactor)
        {
            if (interactor == null)
            {
                return;
            }

            interactor.Grab(Facade);
        }
 /// <summary>
 /// Attempt to grab the Interactable to the given Interactor.
 /// </summary>
 /// <param name="interactor">The Interactor to attach the Interactable to.</param>
 public virtual void Grab(InteractorFacade interactor)
 {
     interactor.Grab(Facade);
 }
        /// <summary>
        /// Attempt to grab the Interactable to the given Interactor.
        /// </summary>
        /// <param name="interactor">The Interactor to attach the Interactable to.</param>
        public virtual void Grab(InteractorFacade interactor)
        {
            interactor.Grab(Facade);
//      print("grabbed");
        }