Пример #1
0
        /// <summary>
        /// Control player weapon using behaviour
        /// </summary>
        private void PlayerShoot()
        {
            if (Input.GetButtonDown("Fire1") && !freezeInput && MVUtility.Geq(weaponPower, ActiveWeapon.WeaponUsage))
            {
                weaponRechargeDelay      = weaponRechargeDelayMax;
                weaponRechargeDelayStart = false;
                weaponCanRecharge        = false;
                ActiveWeapon.StartUse();
                weaponAttackMovingPenalty = weaponAttackMovingPenaltyMax;
                // animator.SetTrigger("Attack");
                // animator.SetBool("HoldFire", true);
            }
            else if (Input.GetButtonUp("Fire1") || freezeInput)
            {
                weaponRechargeDelayStart = true;
                ActiveWeapon.EndUse();
                // animator.SetBool("HoldFire", false);
            }
            else if (Input.GetButton("Fire1") && !freezeInput)
            {
                if (ActiveWeapon.chargeUse && MVUtility.Geq(weaponPower, ActiveWeapon.WeaponUsage) && ActiveWeapon.fired)
                {
                    weaponRechargeDelay       = weaponRechargeDelayMax;
                    weaponRechargeDelayStart  = false;
                    weaponCanRecharge         = false;
                    weaponAttackMovingPenalty = weaponAttackMovingPenaltyMax;
                }
                else
                {
                    weaponRechargeDelayStart = true;
                }

                ActiveWeapon.HoldUse();
            }
        }