Example #1
0
    void AttackWithWeapon(bool input, Weapon weapon, ref bool is_stop_shot)
    {
        if (weapon == null) return;

        if (input)
        {
            weapon.OnAttack();
            is_stop_shot = false;
            if (weapon.CanShot())
            {
                switch (weapon.getType)
                {
                    case WeaponType.LEFT:
                        CmdCreateLeftBullet();
                        break;
                    case WeaponType.RIGHT:
                        CmdCreateRightBullet();
                        break;
                    case WeaponType.BACK:
                        CmdCreateBackBullet();
                        break;
                }
            }
        }
        else
        {
            if (!is_stop_shot)
            {
                weapon.OnNotAttack();
                is_stop_shot = true;
            }
        }
    }
Example #2
0
    void AttackWithWeapon(bool input, Weapon weapon, ref bool is_stop_shot)
    {
        if (weapon == null) return;

        if (input)
        {
            weapon.OnAttack();
            is_stop_shot = false;
            if (weapon.CanShot())
            {
                weapon.CreateBullet();
            }
        }
        else
        {
            if (!is_stop_shot)
            {
                weapon.OnNotAttack();
                is_stop_shot = true;
            }
        }
    }