Example #1
0
    void ShotInput()
    {
        if (!shooterManager || shooterManager.rWeapon == null)
        {
            return;
        }
        if (isAiming && !shooterManager.shotting && aimConditions && !isReloading && !isAttacking)
        {
            if (shooterManager.rWeapon.automaticWeapon ? shotInput.GetButton() : shotInput.GetButtonDown())
            {
                shooterManager.Shoot(aimPosition);
            }

            else if (shotInput.GetButtonDown())
            {
                if (allowAttack == false)
                {
                    shooterManager.Shoot(aimPosition);
                    allowAttack = true;
                }
            }
            else
            {
                allowAttack = false;
            }
        }
    }
Example #2
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;
     }
 }
    protected virtual void ShotInput()
    {
        if (!shooterManager || shooterManager.rWeapon == null)
        {
            return;
        }

        if ((isAiming && !shooterManager.hipfireShot || shooterManager.hipfireShot) && !shooterManager.isShooting && aimConditions && !isReloading && !isAttacking)
        {
            if (shooterManager.rWeapon.automaticWeapon ? shotInput.GetButton() : shotInput.GetButtonDown())
            {
                if (shooterManager.hipfireShot)
                {
                    aimTimming = 3f;
                }
                shooterManager.Shoot(aimPosition, !isAiming);
            }
            else if (shotInput.GetButtonDown())
            {
                if (allowAttack == false)
                {
                    if (shooterManager.hipfireShot)
                    {
                        aimTimming = 1f;
                    }
                    shooterManager.Shoot(aimPosition, !isAiming);
                    allowAttack = true;
                }
            }
            else
            {
                allowAttack = false;
            }
        }
        shooterManager.UpdateShotTime();
    }