Class InventoryAspect
Aspect of an entity that has an inventory.
public class InventoryAspect : EntityAspect, IAspect<Entity>, IAspect
- Inheritance
-
BaseAspect<Entity>InventoryAspect
- Implements
-
IAspect<Entity>
- Inherited Members
- Extension Methods
Constructors
InventoryAspect(EntityAspect, bool)
Initializes a new instance of the EntityAspect class with another aspect.
public InventoryAspect(EntityAspect aspect, bool strict = true)
Parameters
aspect
EntityAspectThe aspect to copy from.
strict
boolIf true, the aspect will throw an exception if the entity is null.
Exceptions
- ArgumentNullException
Thrown when the entity of the aspect is null.
InventoryAspect(Entity, bool)
Initializes a new instance of the EntityAspect class with the specified entity.
public InventoryAspect(Entity entity, bool strict = true)
Parameters
entity
EntityThe entity to associate with this aspect.
strict
boolIf true, the aspect will throw an exception if the entity is null.
Exceptions
- ArgumentNullException
Thrown when the entity is null.
Properties
Items
Gets the inventory items of this entity.
public List<InventoryItemData> Items { get; }
Property Value
Queries
public static InventoryQueries Queries { get; }
Property Value
Methods
CountItems(PrefabGUID?, bool)
Counts the number of items in the inventory, optionally filtering by a specific item GUID.
public int CountItems(PrefabGUID? itemGuid = null, bool includeStacks = true)
Parameters
itemGuid
PrefabGUID?The GUID of the item to filter by. If null, all items are counted.
includeStacks
boolIf true, counts the total amount of items including stacks; if false, counts each item individually.
Returns
- int
The total count of items in the inventory.
Is(Entity)
public static bool Is(Entity entity)
Parameters
entity
Entity
Returns
Qualifies(Entity)
Checks if the entity qualifies for this aspect.
public override bool Qualifies(Entity entity)
Parameters
entity
Entity
Returns
- bool
Returns true if the entity qualifies, otherwise false.