void EquipWeapon(playerweapon _weapon)
    {
        currentweapon = _weapon;

        GameObject _weaponIns = Instantiate(_weapon.graphics, weaponHolder.position, weaponHolder.rotation);

        _weaponIns.transform.SetParent(weaponHolder);

        currentGraphics = _weaponIns.GetComponent <weaponGraphics>();

        if (isLocalPlayer)
        {
            Util.SetLayerRecursively(_weaponIns, LayerMask.NameToLayer(weaponLayerName));
        }
    }
    void Update()
    {
        currentweapon = weaponManager.GetcurrentWeapon();
        if (currentweapon.fireRate <= 0f)
        {
            if (Input.GetButtonDown("Fire1"))
            {
                Shoot();
            }
        }

        else
        {
            if (Input.GetButtonDown("Fire1"))
            {
                InvokeRepeating("Shoot", 0f, 1f / currentweapon.fireRate);
            }
            else if (Input.GetButtonUp("Fire1"))
            {
                CancelInvoke("Shoot");
            }
        }
    }
示例#3
0
 public void FPlayerWeapon_EnemyWeapon(playerweapon PlayerWeapon)
 {
 }