private bool CheckMatchingInventory(ItemSlot item, SlotChestType chestType) { switch (item.item) { case GearItemSO gear: return(chestType == SlotChestType.Gear); case ToolItemSO tool: return(chestType == SlotChestType.Tools); default: return(true); } }
/// <summary> /// /// /// /// /// </summary> public bool CheckEquip(ItemSlot firstItem, SlotChestType targetChestType, int targetButtonID) { if (firstItem == null) { return(true); } //if (!(firstItem.item is GearItemSO || firstItem.item is ToolItemSO) && !(secondItem.item is GearItemSO || secondItem.item is ToolItemSO)) // return false; switch (firstItem.item) { case GearItemSO gear: return(CheckMatchingInventory(firstItem, targetChestType) && CheckIndexToGear(targetButtonID, gear)); case ToolItemSO tool: return(CheckMatchingInventory(firstItem, targetChestType) && CheckIndexToTool(targetButtonID, tool)); default: return(false); } }