Exemple #1
0
        private void SpawnArrow(HandGrabber grabber)
        {
            VrConsole.Log("Arrow spawning.");
            // TODO:
            // object pooling for arrows

            var _arrow = Instantiate(arrowPrefab);

            grabber.heldObject             = _arrow;
            _arrow.transform.parent        = grabber.grabPoint;
            _arrow.transform.localPosition = Vector3.zero;
            _arrow.transform.localRotation = Quaternion.identity;
        }
Exemple #2
0
 private void LeftGrabActionPerformed(InputAction.CallbackContext obj)
 {
     VrConsole.Log("Left grab action performed.");
     if (!canGrabLeft || !IsHoldingBow())
     {
         return;
     }
     if (leftHandGrabber.heldObject != null)
     {
         return;
     }
     SpawnArrow(leftHandGrabber);
 }
Exemple #3
0
 private void RightGrabActionPerformed(InputAction.CallbackContext obj)
 {
     VrConsole.Log("Right grab action performed.");
     if (!canGrabRight || !IsHoldingBow())
     {
         VrConsole.Log("Can grab: " + canGrabRight);
         VrConsole.Log("Holding bow: " + IsHoldingBow());
         return;
     }
     if (rightHandGrabber.heldObject != null)
     {
         VrConsole.Log("Held item: " + rightHandGrabber.heldObject.name);
         return;
     }
     SpawnArrow(rightHandGrabber);
 }
Exemple #4
0
        private void OnTriggerExit(Collider other)
        {
            VrConsole.Log("Quiver trigger exited by: " + other.name);
            var _grabber = other.GetComponent <HandGrabber>();

            if (_grabber == null)
            {
                return;
            }
            if (_grabber == leftHandGrabber)
            {
                canGrabLeft = false;
            }
            if (_grabber == rightHandGrabber)
            {
                canGrabRight = false;
            }
        }