ULimenAttributeBase
Overview
ULimenAttributeBase is a core component in the LimenAbilitySystem module. It manages an attribute's value, recharge rate, and various states such as being full, empty, or frozen. The class inherits from ULimenStorageItem and implements FTickableGameObject, allowing it to be ticked and replicated across networked games.
Properties
Type | Name | Access | Description |
|---|---|---|---|
float | RechargeRate | EditAnywhere, Replicated | The amount to recharge every second. |
bool | bShouldFreezeWhenValueIsReached | EditAnywhere | Determines if the attribute should be frozen when it reaches a specific value range. |
FFloatRange | FreezeRange | EditAnywhere, Meta(EditCondition="bShouldFreezeWhenValueIsReached") | The range of values that trigger freezing. |
float | MaxValue | EditAnywhere, Replicated | The maximum value of the attribute. |
float | InitialValue | EditAnywhere | The initial value when the attribute is initialized. |
bool | bLogValue | EditAnywhere (EditorOnly) | Logs the current value to the console if enabled. |
FFloatRange | RechargeDelay | EditAnywhere | The delay range before recharge starts after reaching a certain state. |
float | CurrentValue | SaveGame, ReplicatedUsing=OnRep_CurrentValue | The current value of the attribute. |
Functions
Return Type | Signature | Description |
|---|---|---|
void | SetRechargeRate(const float Value) | Sets the attribute recharge rate. |
float | GetRechargeRate() const | Getter for the attribute recharge rate. |
void | SetValue(const float Value) | Sets the attribute to a new value, clamping it within min and max limits. |
void | SetMaxValue(const float NewMaxValue) | Changes the maximum value of this attribute. |
void | ModifyValueBy(const float Value) | Modifies the current value by a specified amount, clamping it within min and max limits. |
float | SafeModifyValueBy(const float Value) | Similar to |
void | ModifyValuePercentageBy(const float Percent) | Modifies the current value by a specific percentage, clamping it within min and max limits. |
void | ModifyMaxValueBy(const float Value) | Changes the maximum value of this attribute by a specified amount. |
void | ModifyMaxValuePercentageBy(const float Percent) | Changes the maximum value of this attribute by a specific percentage. |
void | Empty() | Sets the attribute value to the minimum. |
void | Full() | Sets the attribute value to the maximum. |
float | GetMaxValue() const | Gets the current max value. |
float | GetMinValue() const | Gets the current minimum value. |
float | GetCurrentValue() const | Getter for the current value of this attribute. |
float | GetCurrentValueAsPercentage() const | Gets the current value as a percentage in a [0, 100] range. |
float | GetCurrentValueNormalized() const | Gets the current value normalized to a [0, 1] range. |
bool | IsEmpty() const | Checks if the attribute is empty. |
bool | IsFull() const | Checks if the attribute is full. |
float | GetValueUntilMax() const | Gets how much is needed to reach the maximum value. |
void | SetCurrentValueAsMax() | Sets the current value to the maximum, clamping it within min and max limits. |
void | SetCurrentValueAsMin() | Sets the current value to the minimum, clamping it within min and max limits. |
void | SetCurrentValueAs(const float Value) | Sets the current value ignoring restrictions, clamping it within min and max limits. |
GetOwnerAbilityComponent() const | Gets the owner ability component. | |
AActor* | GetOwner() const | Gets the owner actor. |
void | FreezeAttribute(const bool bShouldFreeze) | Freezes or unfreezes the attribute based on a boolean value. |
bool | IsFrozen() const | Checks if the attribute is frozen. |
ULimenAttributeBase& | operator+=(const float Value) | Adds a specified amount to the current value and returns the modified object. |
ULimenAttributeBase& | operator-=(const float Value) | Subtracts a specified amount from the current value and returns the modified object. |
Usage & Implementation Notes
The class is tickable and can be replicated across networked games.
It includes delegates for attribute changes, fullness, and emptiness.
The
Rechargefunction updates the attribute's value based on its recharge rate.The
OnRep_CurrentValuefunction handles replication of the current value and triggers appropriate events.