private void InteractWithItemObject(ItemObject itemObject) { Debug.Assert(itemObject.Item != null); IUsable usable = itemObject.Item as IUsable; IPickupable pickupable = itemObject.Item as IPickupable; IEquipable equipable = itemObject.Item as IEquipable; IStackable stackable = itemObject.Item as IStackable; if (usable != null) { usable.OnUse(_stats, itemObject); } else if (pickupable != null) { if (equipable != null && equipable.IsDurable && _equipment.EquipmentTable[equipable.EquipmentType].IsEmpty) { equipable.OnEquip(_equipment, _stats); } else if (stackable != null) { stackable.OnStack(_inventory); } else { pickupable.OnPutInInventory(_inventory); } pickupable.OnRemoveFromGround(itemObject); } }