private bool TryProcessMedicalAppliance(ZaraEngine.Inventory.IInventoryItem item, ZaraEngine.Injuries.BodyParts bodyPart) { var appliance = item as ZaraEngine.Inventory.InventoryMedicalItemBase; if (item is null) { return(false); } if (appliance is null) { Debug.Log($"The item {item.Name} is not a medical item"); return(false); } if (appliance.MedicineKind != ZaraEngine.Inventory.InventoryMedicalItemBase.MedicineKinds.Appliance) { Debug.Log($"The item {item.Name} is not an appliance"); return(false); } if (!IsApplianceApplicableToBodyPart(appliance, bodyPart)) { Debug.Log($"The item {item.Name} cannot be applied to {bodyPart}"); return(false); } // After all checks are done, and we know that we can use this appliance on a selected body part, we must use this item in the inventory // and notify our health angine that we took some kind of medical thing -- for the health engine to do its job var isUsed = false; var usageResult = _inventory.TryUse(item, checkOnly: false); isUsed = usageResult.Result == ZaraEngine.Inventory.ItemUseResult.UsageResult.UsedAll || usageResult.Result == ZaraEngine.Inventory.ItemUseResult.UsageResult.UsedSingle; if (isUsed) { // Notify the health angine _health.OnApplianceTaken(appliance, bodyPart); RefreshConsumablesUICombo(); RefreshToolsUICombo(); Debug.Log($"Appliance {appliance.Name} was applied to the {bodyPart}"); return(true); } return(false); }