Exemplo n.º 1
0
    private void Ammo(Ammo ammoValue)
    {
        for (int i = 0; i < inventory.weapons.Count; ++i)
        {
            if (inventory.weapons[i].weaponType == ammoValue.GetAmmoType())
            {
                var getAmmo = ammoValue.GetAmmo();

                inventory.weapons[i].ammo += getAmmo;

                ammoUI.text = "Ammo: " + inventory.weapons[i].ammo;

                audioSource.clip = ammoValue.GetAudioClip();

                audioSource.Play();

                setMessage.SetMessage("Picked Up Ammo");

                return;
            }
        }

        setMessage.SetMessage("You do not have this weapon");
    }