Пример #1
0
    IEnumerator ShootLeftGun()
    {
        InstantiateNewShuriken();
        AddForceAndTorqueToEquippedShuriken();
        leftController.PulseVibrate(10, 10, 0.01f, 1);
        swordUI.DepleteFire(usageCost);
        PlayGunNoise(shootingNoise);
        yield return(new WaitForSeconds(0.1f));

        InstantiateNewShuriken();
        AddForceAndTorqueToEquippedShuriken();
        leftController.PulseVibrate(10, 10, 0.01f, 1);
        swordUI.DepleteFire(usageCost);
        PlayGunNoise(shootingNoise);
        yield return(new WaitForSeconds(0.1f));

        InstantiateNewShuriken();
        AddForceAndTorqueToEquippedShuriken();
        leftController.PulseVibrate(10, 10, 0.01f, 1);
        swordUI.DepleteFire(usageCost);
        PlayGunNoise(shootingNoise);
        yield return(new WaitForSeconds(0.5f));

        leftShootingStarted = false;
    }
 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");
                     }
                 }
             }
         }
     }
 }