public void Equip(EquipmentItem item) { if (item == null) { return; } int slotIndex = (int)item.equipmentType; EquipmentItem oldItem = Unequip(slotIndex); if (item.equipmentType == EquipmentType.Weapon) { if (weaponController == null) { Debug.Log("Weapon controller not found."); return; } weaponController.EquipWeapon(item); currentEquipment[slotIndex] = item; player.CharacterStats.UpdateStatText(); inventory.RemoveItem(item.id); equipmentPanel.UpdateEquippableSlot(slotIndex, item); return; } currentEquipment[slotIndex] = item; player.CharacterStats.AddModifiers(item); player.CharacterStats.UpdateStatText(); inventory.RemoveItem(item.id); equipmentPanel.UpdateEquippableSlot(slotIndex, item); }