Esempio n. 1
0
 private void OnReleased(HVRGrabberBase arg0, HVRGrabbable arg1)
 {
     if (RecoilComponent)
     {
         RecoilComponent.HandRigidBody = null;
     }
 }
Esempio n. 2
0
 public void UnregisterGrabber(HVRGrabberBase grabber)
 {
     if (GrabberManager)
     {
         GrabberManager.UnregisterGrabber(grabber);
     }
 }
Esempio n. 3
0
 private void OnGrabbed(HVRGrabberBase arg0, HVRGrabbable arg1)
 {
     if (arg0 is HVRHandGrabber hand && RecoilComponent)
     {
         RecoilComponent.HandRigidBody = hand.Rigidbody;
     }
 }
Esempio n. 4
0
 protected void OnReleased(HVRGrabberBase grabber, HVRGrabbable hvrGrabbable)
 {
     if (DiscardAngle)
     {
         transform.rotation = RotationTarget.rotation;
         transform.position = RotationTarget.position;
     }
 }
Esempio n. 5
0
 protected override void OnReleased(HVRGrabberBase grabber)
 {
     base.OnReleased(grabber);
     if (_emptyPushedBack)
     {
         return;
     }
     Close();
 }
Esempio n. 6
0
        private void OnStabilizerReleased(HVRGrabberBase grabber, HVRGrabbable arg1)
        {
            Grabbable.ForceTwoHandSettings = false;

            if (RecoilComponent)
            {
                RecoilComponent.TwoHanded = false;
            }
        }
Esempio n. 7
0
        private void OnStabilizerGrabbed(HVRGrabberBase grabber, HVRGrabbable arg1)
        {
            if (Grabbable.PrimaryGrabber && Grabbable.PrimaryGrabber.IsHandGrabber)
            {
                Grabbable.ForceTwoHandSettings = true;

                if (RecoilComponent)
                {
                    RecoilComponent.TwoHanded = true;
                }
            }
        }
Esempio n. 8
0
 protected override void OnGrabbed(HVRGrabberBase grabber)
 {
     grabber.ForceRelease();
     if (Arrow)
     {
         grabber.AllowGrabbing = false;
         this.ExecuteNextUpdate(() =>
         {
             grabber.TryGrab(Arrow, true);
             grabber.AllowGrabbing = true;
         });
     }
 }
Esempio n. 9
0
        private void OnReleased(HVRGrabberBase grabber, HVRGrabbable arg1)
        {
            if (!grabber.IsHandGrabber)
            {
                return;
            }

            _handGrabber = null;
            if (ResetOnRelease)
            {
                Close();
            }
        }
Esempio n. 10
0
        private void OnGrabbed(HVRGrabberBase grabber, HVRGrabbable arg1)
        {
            if (!grabber.IsHandGrabber)
            {
                return;
            }

            _handGrabber = grabber as HVRHandGrabber;
            //HandCheckAnchor.transform.localPosition = PumpGrabbable.transform.InverseTransformPoint(_handGrabber.GrabPoint.position);
            HandCheckAnchor.transform.position = _handGrabber.GrabPoint.position;
            _previousHandPosition = _handGrabber.TrackedController.position;
            _previousVelocity     = Vector3.zero;
        }
Esempio n. 11
0
        protected virtual void OnArrowSocketed(HVRGrabberBase arg0, HVRGrabbable grabbable)
        {
            var arrow = grabbable.transform.GetComponent <HVRArrow>();

            if (!arrow)
            {
                NockHand = null;
                Debug.LogWarning($"{grabbable.name} missing HVRArrow component.");
                return;
            }


            OnArrowNocked(arrow);
        }
Esempio n. 12
0
        protected void OnReleased(HVRGrabberBase grabber, HVRGrabbable hvrGrabbable)
        {
            PrimaryGrabber = null;

            if (DiscardAngle)
            {
                if (_rigidBody)
                {
                    _rigidBody.MoveRotation(RotationTarget.rotation);
                }
                else
                {
                    transform.localRotation = RotationTarget.localRotation;
                }
            }
        }
Esempio n. 13
0
        private void OnGrabbableActivated(HVRGrabberBase arg0, HVRGrabbable arg1)
        {
            if (!CanFire())
            {
                OnOutofAmmo();
                return;
            }

            if (FireType == FireType.Single)
            {
                if (_timer < Cooldown)
                {
                    return;
                }

                _timer = 0f;

                OnFired();
                AfterFired();
                return;
            }

            if (FireType == FireType.Automatic)
            {
                _isFiring = true;
                if (_automaticRoutine != null)
                {
                    StopCoroutine(_automaticRoutine);
                }
                _automaticRoutine = StartCoroutine(Automatic());
                return;
            }

            if (FireType == FireType.Burst)
            {
                if (_timer < Cooldown)
                {
                    return;
                }

                _timer = 0f;
            }
        }
Esempio n. 14
0
        protected virtual void OnAmmoGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable)
        {
            var ammo = grabbable.GetComponent <HVRAmmo>();

            if (!ammo)
            {
                Debug.Log($"{grabbable.name} is missing the ammo component.");
                return;
            }

            Ammo = ammo;

            foreach (var ourCollider in Grabbable.Colliders)
            {
                foreach (var ammoCollider in grabbable.Colliders)
                {
                    Physics.IgnoreCollision(ourCollider, ammoCollider, true);
                }
            }
        }
Esempio n. 15
0
 public void RegisterGrabber(HVRGrabberBase grabber)
 {
     grabber.BeforeGrabbed.AddListener(OnBeforeGrabberGrabbed);
     grabber.Grabbed.AddListener(OnGrabberGrabbed);
     grabber.Released.AddListener(OnGrabberReleased);
 }
Esempio n. 16
0
 protected virtual void OnGrabbableDeactivated(HVRGrabberBase arg0, HVRGrabbable arg1)
 {
     _isFiring = false;
 }
Esempio n. 17
0
 private void OnGrabbed(HVRGrabberBase arg0, HVRGrabbable arg1)
 {
     Flying = false;
 }
Esempio n. 18
0
 protected override void OnGrabbed(HVRGrabberBase grabber)
 {
     _emptyPushedBack = false;
     base.OnGrabbed(grabber);
     GrabbedPositionTracker.transform.localPosition = transform.InverseTransformPoint(grabber.transform.position);
 }
Esempio n. 19
0
 protected virtual void OnReleased(HVRGrabberBase arg0, HVRGrabbable arg1)
 {
 }
Esempio n. 20
0
 private void BeforeNockHovered(HVRGrabberBase grabber, HVRGrabbable grabbable)
 {
     NockHand = grabbable.PrimaryGrabber as HVRHandGrabber;
 }
Esempio n. 21
0
 public void UnregisterGrabber(HVRGrabberBase grabber)
 {
     grabber.Grabbed.RemoveListener(OnGrabberGrabbed);
     grabber.Released.RemoveListener(OnGrabberReleased);
 }
Esempio n. 22
0
 protected virtual void OnNockedArrowGrabbed(HVRGrabberBase arg0, HVRGrabbable arg1)
 {
     OnArrowDropped();
 }
Esempio n. 23
0
 protected virtual void OnGrabberGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable)
 {
 }
Esempio n. 24
0
        protected override void OnReleased(HVRGrabberBase grabber)
        {
            base.OnReleased(grabber);

            Close();
        }