Class CharacterAspect
Character aspect in the game, providing access to character-specific data and functionality.
public class CharacterAspect : UnitAspect, IAspect<Entity>, IAspect
- Inheritance
-
BaseAspect<Entity>CharacterAspect
- Implements
-
IAspect<Entity>
- Inherited Members
- Extension Methods
Constructors
CharacterAspect(EntityAspect, bool)
Initializes a new instance of the CharacterAspect class from an existing EntityAspect.
public CharacterAspect(EntityAspect aspect, bool strict = true)
Parameters
aspectEntityAspectThe existing EntityAspect to initialize from.
strictboolIf true, enforces strict type checking. Default is true.
CharacterAspect(Entity, bool)
Initializes a new instance of the CharacterAspect class from an Unity.Entities.Entity.
public CharacterAspect(Entity entity, bool strict = true)
Parameters
entityEntityThe Unity.Entities.Entity to initialize from.
strictboolIf true, enforces strict type checking. Default is true.
Properties
Equipment
Gets the equipment aspect of the character, if available.
public EquipmentAspect? Equipment { get; }
Property Value
Level
Gets the level of the character, if available.
public override float? Level { get; }
Property Value
Queries
public static CharacterQueries Queries { get; }
Property Value
Methods
AddItemToInventory(PrefabGUID, int, out Entity, int, bool, bool, bool)
Adds an item to an entity's inventory with optional equipping and dropping functionality.
public AddItemResponse AddItemToInventory(PrefabGUID guid, int amount, out Entity entity, int startSlot = 0, bool dropRemainder = true, bool tryEquip = true, bool onlyFillEmptySlots = false)
Parameters
guidPrefabGUIDThe prefab GUID of the item to add.
amountintThe quantity of items to add.
entityEntityOutput parameter that receives the newly created item entity.
startSlotintThe inventory slot to place the item in. Default is 0.
dropRemainderboolIf true, drops excess items that don't fit in inventory. Default is true.
tryEquipboolIf true, attempts to equip the item after adding. Default is true.
onlyFillEmptySlotsboolIf true, Will only fill empty slots and not auto stack. Default false.
Returns
- AddItemResponse
True if the item was successfully added to the inventory, false otherwise.
ClearInventory()
Clears the inventory of a specified entity.
public void ClearInventory()
GetBloodBuffInfo()
Gets the blood buff information for the character, if available.
public BloodBuffInfo? GetBloodBuffInfo()
Returns
- BloodBuffInfo
A ProjectM.UI.BloodBuffInfo object containing the blood buff information, or null if not available.
GetDurabilityInfo(EquipmentType)
Gets the durability information for a specified equipment type.
public DurabilityInfo? GetDurabilityInfo(EquipmentType equipmentType)
Parameters
equipmentTypeEquipmentTypeThe type of equipment to retrieve durability information for.
Returns
- DurabilityInfo?
A ProjectM.UI.DurabilityInfo object containing the durability information, or null if not available.
GetInventoryItems(int)
Gets the inventory items of the character at a specified index.
public List<InventoryItemData>? GetInventoryItems(int index = 0)
Parameters
indexintThe index of the inventory to retrieve items from. Default is 0.
Returns
- List<InventoryItemData>
A list of inventory items, or null if the inventory entity is not found.
GetItemSetInfo(PrefabGUID)
Gets the item set information for a specified prefab GUID.
public ItemSetInfo GetItemSetInfo(PrefabGUID prefabGuid)
Parameters
prefabGuidPrefabGUIDThe prefab GUID to retrieve item set information for.
Returns
- ItemSetInfo
A ProjectM.UI.ItemSetInfo object containing the item set information, or null if not available.
GetSlotCounts()
public (int freeSlots, int totalSlots) GetSlotCounts()
Returns
GetStashes(bool)
Gets the stashes of the character, optionally filtering by allied only.
public IEnumerable<InventoryAspect> GetStashes(bool alliedOnly = false)
Parameters
alliedOnlyboolIf true, only retrieves stashes that are allied. Default is false.
Returns
- IEnumerable<InventoryAspect>
An enumerable collection of InventoryAspect representing the stashes.
GetUnlockInfo(PrefabGUID)
Gets the unlock information for a specified prefab GUID.
public UnlockInfo? GetUnlockInfo(PrefabGUID prefabGuid)
Parameters
prefabGuidPrefabGUIDThe prefab GUID to retrieve unlock information for.
Returns
- UnlockInfo
A ProjectM.UI.UnlockInfo object containing the unlock information, or null if not available.
Is(Entity)
public static bool Is(Entity entity)
Parameters
entityEntity
Returns
Qualifies(Entity)
Checks if the entity qualifies for this aspect.
public override bool Qualifies(Entity entity)
Parameters
entityEntity
Returns
- bool
Returns true if the entity qualifies, otherwise false.
TryGiveItem(PrefabGUID, int, out Entity)
Attempts to give an item to the character's inventory.
public bool TryGiveItem(PrefabGUID itemGuid, int amount, out Entity itemEntity)
Parameters
itemGuidPrefabGUIDThe prefab GUID of the item to give.
amountintThe quantity of the item to give.
itemEntityEntityOutput parameter that receives the newly created item entity.
Returns
- bool
True if the item was successfully given, false otherwise.