示例#1
0
 protected virtual void HandleShot(vShooterWeapon weapon, GenericInput weaponInput, bool secundaryShot = false)
 {
     if (weapon.chargeWeapon)
     {
         if (weapon.ammoCount > 0 && weapon.powerCharge < 1 && weaponInput.GetButton())
         {
             weapon.powerCharge += Time.deltaTime * weapon.chargeSpeed;
         }
         else if ((weapon.powerCharge >= 1 && weapon.autoShotOnFinishCharge) || weaponInput.GetButtonUp() || (!weaponInput.GetButton() && isAiming && weapon.powerCharge > 0))
         {
             if (shooterManager.hipfireShot)
             {
                 aimTimming = 3f;
             }
             shooterManager.Shoot(aimPosition, !isAiming, secundaryShot);
             weapon.powerCharge = 0;
         }
         animator.SetFloat("PowerCharger", weapon.powerCharge);
     }
     else if (weapon.automaticWeapon ? weaponInput.GetButton() : weaponInput.GetButtonDown())
     {
         if (shooterManager.hipfireShot)
         {
             aimTimming = 3f;
         }
         shooterManager.Shoot(aimPosition, !isAiming, secundaryShot);
     }
     else if (weaponInput.GetButtonDown())
     {
         if (allowAttack == false)
         {
             if (shooterManager.hipfireShot)
             {
                 aimTimming = 1f;
             }
             shooterManager.Shoot(aimPosition, !isAiming, secundaryShot);
             allowAttack = true;
         }
     }
     else
     {
         allowAttack = false;
     }
 }
示例#2
0
 void UpdateInput()
 {
     if (aimThrowInput.GetButtonDown() && !isAiming && !inThrow)
     {
         isAiming = true;
         tpInput.cc.lockInStrafe = true;
         animator.CrossFadeInFixedTime(holdingAnimation, 0.2f);
         onEnableAim.Invoke();
     }
     if (aimThrowInput.GetButtonUp())
     {
         isAiming = false;
         tpInput.cc.lockInStrafe = false;
         animator.CrossFadeInFixedTime(cancelAnimation, 0.2f);
         onCancelAim.Invoke();
     }
     if (throwInput.GetButtonDown() && isAiming && !inThrow)
     {
         isAiming     = false;
         isThrowInput = true;
     }
 }