ULimenVariableMovementAbility
Overview
ULimenVariableMovementAbility is a subclass of ULimenActiveAbility that handles character movement modes such as walking, sprinting, and crouching. It manages the stamina attribute to control the duration of these movements.
Properties
Type | Name | Access | Description |
|---|---|---|---|
float | SprintSpeed | EditDefaultsOnly | Speed at which the character moves when sprinting. |
float | CrouchSprintSpeed | EditDefaultsOnly | Speed at which the character moves when crouching and sprinting. |
float | WalkSpeed | EditDefaultsOnly | Speed at which the character moves while walking. |
float | CrouchWalkSpeed | EditDefaultsOnly | Speed at which the character moves while crouching and walking. |
float | SprintStaminaDrainRate | EditDefaultsOnly | Rate at which stamina is drained when sprinting. |
TObjectPtr< ULimenStaminaAttribute > | Stamina | Private | Pointer to the stamina attribute component. |
bool | bWantsToSprint | Private | Flag indicating if the character wants to sprint. |
bool | bIsSprinting | Private | Flag indicating if the character is currently sprinting. |
Functions
Return Type | Signature | Description |
|---|---|---|
void | Initialize(AActor* InOwner) | Initializes the ability with the owner actor and sets up movement components and stamina attribute. |
void | Tick(float DeltaTime) | Updates the ability state, drains stamina when sprinting, and switches between walking and sprinting modes based on user input and stamina levels. |
bool | CanActivateAbility() const | Determines if the ability can be activated based on the owner's movement component and stamina level. |
void | AbilityActivated(AController* Controller, APawn* Pawn) | Called when the ability is activated; sets |
void | SetSprintMode() | Sets the character to sprint mode by updating the maximum walk speed of the movement component. |
void | SetWalkMode() | Sets the character to walking mode by updating the maximum walk speed of the movement component. |
void | AbilityCancelled(AController* Controller, APawn* Pawn) | Called when the ability is cancelled; resets |
Usage & Implementation Notes
Threading Constraints: This class does not involve any multi-threading.
Replication Requirements: None.
Memory Lifetime Management: The stamina attribute and movement component are managed by the owner actor, ensuring proper lifetime management.
Initialization Dependencies: Depends on
ULimenStaminaAttributeandUCharacterMovementComponent.