ULimenAbilityComponent
Overview
ULimenAbilityComponent is an ActorComponent that manages abilities and attributes for actors in the game. It handles the lifecycle of these components, ensuring they are properly initialized, activated, deactivated, and destroyed. The component also provides methods to add, retrieve, and manage individual abilities and attributes.
Properties
Type | Name | Access | Description |
|---|---|---|---|
FAbilityArray | Abilities | Transient | Array of soft class pointers referencing ability classes in the Limen system. These classes define the abilities that can be associated with the actor and are loaded and used dynamically during gameplay. |
FAttributeArray | Attributes | Transient | Array of attribute class references used to define and manage specific attributes within the Limen ability system. These classes serve as templates for attributes associated with gameplay elements. |
int32 | AuthAbilityCount | ReplicatedUsing=OnRep_ServerAbilityCount, Transient | Number of abilities on the server. Used for replication purposes. |
int32 | AuthAttributeCount | ReplicatedUsing=OnRep_ServerAttributeCount, Transient | Number of attributes on the server. Used for replication purposes. |
bool | bAbilitiesLoaded | None | Flag indicating whether abilities have been loaded. |
bool | bAttributesLoaded | None | Flag indicating whether attributes have been loaded. |
bool | bAbilitiesInstantiated | None | Flag indicating whether abilities have been instantiated. |
bool | bAttributesInstantiated | None | Flag indicating whether attributes have been instantiated. |
Functions
Return Type | Signature | Description |
|---|---|---|
void | GetLifetimeReplicatedProps(TArray & OutLifetimeProps) const | Registers properties to be replicated across the network. |
void | EndPlay(const EEndPlayReason::Type EndPlayReason) override | Handles end play events, deactivating and destroying abilities and attributes if the component has authority. |
void | Activate(bool bReset = false) override | Activates the ability component, initializing and instantiating abilities and attributes if necessary. |
void | Deactivate() override | Deactivates all abilities and attributes associated with the component. |
void | AddAbilityClass(const TSubclassOf< ULimenAbilityBase >& AbilityClass) | Adds a new ability class to the list of classes to be instantiated later. |
template void AddAbilityClass() | Template version of AddAbilityClass that takes a specific ability class type. | |
void | AddAttributeClass(const TSubclassOf< ULimenAttributeBase >& AttributeClass) | Adds a new attribute class to the list of classes to be instantiated later. |
template void AddAttributeClass() | Template version of AddAttributeClass that takes a specific attribute class type. | |
ULimenAbilityBase* AddAbility(const TSubclassOf< ULimenAbilityBase >& AbilityClass) | Adds and initializes a new ability based on the provided class. | |
template T* AddAbility() | Template version of AddAbility that returns the newly created ability as the specified type. | |
ULimenAttributeBase* AddAttribute(const TSubclassOf< ULimenAttributeBase >& AttributeClass) | Adds and initializes a new attribute based on the provided class. | |
template T* AddAttribute() | Template version of AddAttribute that returns the newly created attribute as the specified type. | |
bool | IsReadyForGameplay() const | Determines whether the ability component is ready for gameplay by checking if abilities and attributes have been successfully loaded and initialized. |
void | DeactivateAllAbilities() | Deactivates all abilities associated with the component. |
void | DestroyAllAbilities() | Destroys all abilities associated with the component, removing them from replication and destroying their objects. |
void | DeactivateAllAttributes() | Deactivates all attributes associated with the component. |
void | DestroyAllAttributes() | Destroys all attributes associated with the component, removing them from replication and destroying their objects. |
ULimenAbilityBase* GetAbility(const TSubclassOf< ULimenAbilityBase > AbilityClass, const FName& DevelopmentName = NAME_None) const | Retrieves an ability of the specified class type from the managed abilities. | |
ULimenAttributeBase* GetAttribute(const TSubclassOf< ULimenAttributeBase > AttributeClass, const FName& DevelopmentName = NAME_None) const | Retrieves an attribute of the specified class type from the managed attributes. | |
template [ULimenAbilityBase](LimenAbilityBase.md)> AbilityClass* GetAbility(const FName& DevelopmentName = NAME_None) | Template version of GetAbility that returns the ability as the specified type. | |
template [ULimenAttributeBase](LimenAttributeBase.md)> AttributeClass* GetAttribute(const FName& DevelopmentName = NAME_None) const | Template version of GetAttribute that returns the attribute as the specified type. | |
TArray< ULimenAbilityBase *> GetAbilities() const | Retrieves a list of abilities currently associated with the component. | |
TArray< ULimenAttributeBase *> GetAttributes() const | Retrieves all attributes currently associated with this ability component. | |
template [ULimenAbilityBase](LimenAbilityBase.md)> void InitializeAbilityDependency() | Ensures that the specified ability dependency is initialized. | |
template [ULimenAttributeBase](LimenAttributeBase.md)> void InitializeAttributeDependency() | Ensures that an attribute dependency within the ability system is properly initialized. |
Usage & Implementation Notes
The component uses replication to ensure that abilities and attributes are synchronized across the network.
Abilities and attributes are managed using arrays of soft class pointers, allowing for dynamic loading and instantiation.
The component provides methods to add, retrieve, and manage individual abilities and attributes.
The component ensures that all abilities and attributes are properly initialized before gameplay begins.