public bool AutoPickUpWeapon(WeaponInfo weaponInfo) { Logger.DebugFormat("AutoPickUpWeapon {0}", weaponInfo.Id); var weapon = SingletonManager.Get <WeaponConfigManager>().GetConfigById(weaponInfo.Id); if (null != weapon) { var weaponType = SingletonManager.Get <WeaponConfigManager>().GetWeaponType(weaponInfo.Id); if (!weaponType.CanAutoPick()) { return(false); } var slotType = GetMatchSlot((EWeaponType)weapon.Type); if (slotType != EWeaponSlotType.None) { if (_weaponBagLogic.HasWeaponInSlot(slotType)) { return(false); } var noWeaponInHand = _weaponBagLogic.GetCurrentWeaponSlot() == EWeaponSlotType.None; _weaponActionListener.OnPickup(_playerEntity, slotType); var last = ReplaceWeaponToSlot(slotType, weaponInfo, false); //var last = _weaponBagLogic.AddWeaponToSlot(slotType, weaponInfo); if (noWeaponInHand) { TryMountWeapon(slotType); } return(true); } else { Logger.Error("Illegal Slot type for weapon "); return(false); } } else { return(false); } }
public void OnPickup(Entity playerEntity, EWeaponSlotType slot) { _weaponActionListener.OnPickup(playerEntity, slot); }