public void EquipWeaponAt(EquipWeaponAt selection, ObjectContainedInventory itemToEquip) { if (selection == ProjetSynthese.EquipWeaponAt.Primary) { if (primaryWeapon != null) { UnequipWeaponAt(ProjetSynthese.EquipWeaponAt.Primary); } primaryWeapon = itemToEquip; CheckMultiplePresenceAndRemove(itemToEquip); NotifyWeaponEquip(); } if (selection == ProjetSynthese.EquipWeaponAt.Secondary) { if (secondaryWeapon != null) { UnequipWeaponAt(ProjetSynthese.EquipWeaponAt.Secondary); } secondaryWeapon = itemToEquip; CheckMultiplePresenceAndRemove(itemToEquip); NotifyWeaponEquip(); } }
public void UnequipWeaponAt(EquipWeaponAt selection) { if (selection == ProjetSynthese.EquipWeaponAt.Primary && primaryWeapon != null) { if (!IsItemPresentInInventory(primaryWeapon)) { ListInventory.Add(primaryWeapon); } AddWeight(primaryWeapon.GetItem().GetWeight()); primaryWeapon = null; NotifyInventoryChange(); } if (selection == ProjetSynthese.EquipWeaponAt.Secondary && secondaryWeapon != null) { if (!IsItemPresentInInventory(secondaryWeapon)) { ListInventory.Add(secondaryWeapon); } AddWeight(secondaryWeapon.GetItem().GetWeight()); secondaryWeapon = null; NotifyInventoryChange(); } }
private void InstantiateCellObject(GameObject cellPrefabs, Transform grid, ObjectContainedInventory item, EquipWeaponAt equipWeaponAt = EquipWeaponAt.Primary) { GameObject gameCellObject = Instantiate(cellPrefabs); gameCellObject.transform.SetParent(grid, false); CellObject cellObject = gameCellObject.GetComponentInChildren <CellObject>(); cellObject.Inventory = inventory; cellObject.Control = this; cellObject.InstantiateCellObjectFromCell(item); if (cellPrefabs == cellEquippedWeaponPrefabs) { cellObject.EquipAt = equipWeaponAt; } }