示例#1
0
 public WeaponSlot TakeWeapon(CollectibleWeapon weapon)
 {
     if (weapon == null)
     {
         return(null);
     }
     if (weapon.WeaponInstance == null || weapon.WeaponType == WeaponType.Nothing)
     {
         return(null);
     }
     return(AddWeapon(weapon));
 }
示例#2
0
 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();
 }
示例#3
0
    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);
    }