Namespace: GGG.Equipment
Public runtime contract for querying and changing equipped-item state.
public interface IEquipment
Properties
Slots
Gets the runtime slots in their configured order.
IReadOnlyList<EquipmentSlot> Slots { get; }
Property Value
Methods
CanEquip(ItemInstance, EquipmentSlotDefinition)
Determines whether the item can occupy the specified equipment slot.
bool CanEquip(ItemInstance item, EquipmentSlotDefinition slotDefinition)
Parameters
item ItemInstance
The runtime item instance to inspect or modify.
slotDefinition EquipmentSlotDefinition
The equipment slot definition to inspect or use.
Returns
Whether the specified condition is satisfied.
ContainsSlot(EquipmentSlotDefinition)
Determines whether the loadout contains the requested slot definition.
bool ContainsSlot(EquipmentSlotDefinition slotDefinition)
Parameters
slotDefinition EquipmentSlotDefinition
The equipment slot definition to inspect or use.
Returns
Whether the specified condition is satisfied.
IsEquipped(ItemInstance)
Determines whether the specified item is currently equipped.
bool IsEquipped(ItemInstance item)
Parameters
item ItemInstance
The runtime item instance to inspect or modify.
Returns
Whether the specified condition is satisfied.
TryClear(out IReadOnlyList<ItemInstance>)
Attempts to clear all occupied slots, returning removed items.
bool TryClear(out IReadOnlyList<ItemInstance> unequippedItems)
Parameters
unequippedItems IReadOnlyList<ItemInstance>
Receives items unequipped by the operation.
Returns
Whether the operation succeeded.
TryEquip(ItemInstance, EquipmentSlotDefinition, out ItemInstance)
Attempts to equip an item in the specified slot.
bool TryEquip(ItemInstance item, EquipmentSlotDefinition slotDefinition, out ItemInstance replacedItem)
Parameters
item ItemInstance
The runtime item instance to inspect or modify.
slotDefinition EquipmentSlotDefinition
The equipment slot definition to inspect or use.
replacedItem ItemInstance
Receives an item displaced from the equipment slot, if any.
Returns
Whether the operation succeeded.
TryGetEquippedItem(EquipmentSlotDefinition, out ItemInstance)
Attempts to find the item equipped in the specified slot.
bool TryGetEquippedItem(EquipmentSlotDefinition slotDefinition, out ItemInstance item)
Parameters
slotDefinition EquipmentSlotDefinition
The equipment slot definition to inspect or use.
item ItemInstance
Receives the resulting item when successful.
Returns
Whether the operation succeeded.
TryGetSlot(EquipmentSlotDefinition, out EquipmentSlot)
Attempts to find the specified runtime slot.
bool TryGetSlot(EquipmentSlotDefinition slotDefinition, out EquipmentSlot slot)
Parameters
slotDefinition EquipmentSlotDefinition
The equipment slot definition to inspect or use.
slot EquipmentSlot
Receives the matching runtime slot when found.
Returns
Whether the operation succeeded.
TryGetSlot(string, out EquipmentSlot)
Attempts to find the specified runtime slot.
bool TryGetSlot(string slotId, out EquipmentSlot slot)
Parameters
slotId string
The identifier of the equipment slot.
slot EquipmentSlot
Receives the matching runtime slot when found.
Returns
Whether the operation succeeded.
TryUnequip(EquipmentSlotDefinition, out ItemInstance)
Attempts to remove the equipped item from the specified slot.
bool TryUnequip(EquipmentSlotDefinition slotDefinition, out ItemInstance unequippedItem)
Parameters
slotDefinition EquipmentSlotDefinition
The equipment slot definition to inspect or use.
unequippedItem ItemInstance
Receives the previously equipped item when successful.
Returns
Whether the operation succeeded.
Changed
Raised when the underlying runtime state changes.
event Action<EquipmentChange> Changed