public WeaponSlot TakeWeapon(CollectibleWeapon weapon) { if (weapon == null) { return(null); } if (weapon.WeaponInstance == null || weapon.WeaponType == WeaponType.Nothing) { return(null); } return(AddWeapon(weapon)); }
public void FillWeapon(CollectibleWeapon weapon) { name = weapon.Name; description = weapon.Description; ammo = weapon.Ammo; magazine = weapon.Magazine; type = weapon.WeaponType; bulletType = weapon.BulletType; weaponTypeId = weapon.WeaponTypeId; weaponInstance = weapon.WeaponInstance; id = weapon.Id; RenderWeapon(); }
private WeaponSlot AddWeapon(CollectibleWeapon weapon) { for (int i = 0; i < WeaponsSlots.Count; i++) { if (WeaponsSlots[i].Type == WeaponType.Nothing || WeaponsSlots[i].Type == weapon.WeaponType) { WeaponsSlots[i].FillWeapon(weapon); ItemSlot item = ItensSlots.Find(lambdaExpression => lambdaExpression.Type == WeaponsSlots[i].BulletType); if (item != null) { AddAmmo(WeaponsSlots[i], item.Quantity); item.Reset(); } return(weaponsSlots[i]); } } return(null); }