Exemplo n.º 1
0
 void Update()
 {
     if (swordUI.FireIsDepleted())
     {
         return;
     }
     if ((leftController.controller.GetPressDown(leftController.triggerButton) /*&& !leftShootingStarted*/))
     {
         leftShootingStarted = true;
         StartCoroutine("ShootLeftGun");
     }
 }
 void Update()
 {
     if (swordUI.FireIsDepleted())
     {
         return;
     }
     if (attachedGun.gameObject.activeSelf)
     {
         return;
     }
     if (attachedHand.HoldButtonDown)
     {
         if (attachedHand.CurrentlyInteracting == null)
         {
             VibrateController();
             PrepareShuriken();
             attachedHand.BeginInteraction(instantiatedShuriken.GetComponent <NVRInteractableItem>());
         }
     }
     else if (attachedHand.HoldButtonUp)
     {
         if (attachedHand.CurrentlyInteracting != null)
         {
             if (attachedHand.CurrentlyInteracting.gameObject.CompareTag("Shuriken"))
             {
                 if (instantiatedShuriken != null)
                 {
                     if (attachedHand.CurrentlyInteracting == instantiatedShuriken.GetComponent <NVRInteractableItem>())
                     {
                         VibrateController();
                         attachedHand.EndInteraction(instantiatedShuriken.GetComponent <NVRInteractableItem>());
                         swordUI.DepleteFire(usageCost);
                         instantiatedShuriken.GetComponent <Rigidbody>().AddForce(instantiatedShuriken.GetComponent <Rigidbody>().velocity.normalized);
                         instantiatedShuriken.GetComponent <Shuriken>().SetThrown(true);
                         PlayShurikenNoise();
                         StartCoroutine("ShootShurikens");
                         StartCoroutine("ShootWaitTime");
                     }
                 }
             }
         }
     }
 }