mirror of
https://github.com/Ed94/Cog.git
synced 2026-06-13 08:02:23 -07:00
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "AbilitySystemComponent.h"
|
|
#include "Kismet/BlueprintAsyncActionBase.h"
|
|
|
|
#include "CogSampleTask_WaitAttributeChanged.generated.h"
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnAttributeChangedDelegate, FGameplayAttribute, Attribute, float, NewValue, float, OldValue)
|
|
;
|
|
/**
|
|
* Blueprint node to automatically register a listener for all attribute changes in an AbilitySystemComponent.
|
|
*/
|
|
UCLASS(BlueprintType, meta = (ExposedAsyncProxy = AsyncTask))
|
|
class UCogSampleTask_WaitAttributeChanged : public UBlueprintAsyncActionBase
|
|
{
|
|
GENERATED_BODY()
|
|
public:
|
|
|
|
UPROPERTY(BlueprintAssignable)
|
|
FOnAttributeChangedDelegate OnAttributeChanged;
|
|
|
|
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"))
|
|
static UCogSampleTask_WaitAttributeChanged* ListenForAttributeChange(UAbilitySystemComponent* AbilitySystemComponent, FGameplayAttribute Attribute);
|
|
|
|
virtual void Activate() override;
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
void EndTask();
|
|
|
|
protected:
|
|
|
|
UPROPERTY()
|
|
UAbilitySystemComponent* AbilitySystemComponent = nullptr;
|
|
|
|
FGameplayAttribute AttributeToListenFor;
|
|
|
|
void AttributeChanged(const FOnAttributeChangeData& Data);
|
|
|
|
}; |