public void AddWeaponDamage(Class_Weapon _weapon)
 {
     if (_weapon != null)
     {
         _weapon.weaponInfo.damage += addWeaponDamage;
     }
 }
 public void ReduceWeaponDamage(Class_Weapon _weapon)
 {
     if (_weapon != null)
     {
         _weapon.weaponInfo.damage -= addWeaponDamage;
     }
 }
 void OnEnable()
 {
     Class_Weapon.WeaponPickListener.AddListener(PickWeapon);
     weapon = characterPhysics.GetComponentInChildren <Class_Weapon>();
     StartCoroutine("Shooting");
     StartCoroutine("Filp");
 }
예제 #4
0
 public void ResetReloadMagazine(Class_Weapon _weapon)
 {
     if (_weapon != null)
     {
         _weapon.weaponInfo.relodeSpeed += reloadTimeReduce;
     }
 }
예제 #5
0
        public void UpdateWeaponSprite(Class_Weapon _weapon)
        {
            GameObject pickedWeapon = null;

            if (_weapon.isPicked)
            {
                pickedWeapon = _weapon.gameObject;
            }
            else
            {
                GameObject[] weapons = GameObject.FindGameObjectsWithTag("Weapon");
                foreach (GameObject weapon in weapons)
                {
                    if (weapon.GetComponent <Class_Weapon>().isPicked)
                    {
                        pickedWeapon = weapon;
                        break;
                    }
                }
            }

            currentWeapon.transform.localPosition = preWeaponPos;
            if (pickedWeapon == null)
            {
                currentWeapon.GetComponent <SpriteRenderer>().sprite = null;
            }
            else
            {
                currentWeapon.GetComponent <SpriteRenderer>().sprite = pickedWeapon.GetComponent <SpriteRenderer>().sprite;
                currentWeapon.transform.localPosition -= (Vector3)pickedWeapon.GetComponent <Collider2D>().offset * 2;
            }
        }
 public void ExtendMagazine(Class_Weapon _weapon)
 {
     if (_weapon != null)
     {
         preAmmo = _weapon.originalWeaponInfo.ammo;
         _weapon.weaponInfo.ammo += Mathf.RoundToInt(preAmmo * addAmmoRatio);
     }
 }
예제 #7
0
 public void ReduceMagazine(Class_Weapon _weapon)
 {
     if (_weapon != null)
     {
         _weapon.weaponInfo.ammo -= Mathf.RoundToInt(preAmmo * addMagazineRatio);
         if (_weapon.ammo > _weapon.weaponInfo.ammo)
         {
             _weapon.ammo = _weapon.weaponInfo.ammo;
         }
     }
 }
예제 #8
0
        void RotatePlayer(float _inputHorizontal)
        {
            if (death || stop)
            {
                return;
            }
            if (_inputHorizontal == 1)
            {
                transform.rotation = Quaternion.Euler(0, 0, 0);
            }
            else if (_inputHorizontal == -1)
            {
                transform.rotation = Quaternion.Euler(0, 180f, 0);
            }
            Class_Weapon weapon = GetComponentInChildren <Class_Weapon>();

            if (weapon && weapon.isFixed)
            {
                weapon.transform.rotation = weapon.preRotate;
            }
        }
 void PickWeapon(Class_Weapon _weapon)
 {
     weapon = _weapon;
 }