/// <summary> /// Equip the given item for the given user. This won't check about requirement, this should be done by the /// inventory before calling equip! /// </summary> /// <param name="item">Which item to equip</param> public void Equip(EquipmentItem item) { Unequip(item.Slot, true); OnEquiped?.Invoke(item); switch (item.Slot) { case EquipmentItem.EquipmentSlot.Head: { m_HeadSlot = item; m_HeadSlot.EquippedBy(m_Owner); } break; case EquipmentItem.EquipmentSlot.Torso: { m_TorsoSlot = item; m_TorsoSlot.EquippedBy(m_Owner); } break; case EquipmentItem.EquipmentSlot.Legs: { m_LegsSlot = item; m_LegsSlot.EquippedBy(m_Owner); } break; case EquipmentItem.EquipmentSlot.Feet: { m_FeetSlot = item; m_FeetSlot.EquippedBy(m_Owner); } break; case EquipmentItem.EquipmentSlot.Accessory: { m_AccessorySlot = item; m_AccessorySlot.EquippedBy(m_Owner); } break; //special value for weapon case (EquipmentItem.EquipmentSlot) 666: Weapon = item as Weapon; Weapon.EquippedBy(m_Owner); break; default: break; } }
/// <summary> /// Equip the given item for the given user. This won't check about requirement, this should be done by the /// inventory before calling equip! /// </summary> /// <param name="item">Which item to equip</param> public void Equip(EquipmentItem item) { OnEquiped?.Invoke(item); switch (item.slot) { case EquipmentItem.EquipmentSlot.Head: { _headSlot = item; _headSlot.EquippedBy(_owner); } break; case EquipmentItem.EquipmentSlot.Torso: { _torsoSlot = item; _torsoSlot.EquippedBy(_owner); } break; case EquipmentItem.EquipmentSlot.Legs: { _legsSlot = item; _legsSlot.EquippedBy(_owner); } break; case EquipmentItem.EquipmentSlot.Feet: { _feetSlot = item; _feetSlot.EquippedBy(_owner); } break; case EquipmentItem.EquipmentSlot.Accessory: { _accessorySlot = item; _accessorySlot.EquippedBy(_owner); } break; case EquipmentItem.EquipmentSlot.Weapon: { Weapon = item as WeaponItem; Weapon.EquippedBy(_owner); } break; default: throw new ArgumentOutOfRangeException(); } }