17 lines
619 B
C++
17 lines
619 B
C++
#include "Level/Actor/Components/BusyAbilitySystemComponent.h"
|
|
|
|
void UBusyAbilitySystemComponent::BindEventToAttributeChange(const UClass* AttributeSetClass, const FName& AttributeName, FOnBusyAttributeChange Delegate)
|
|
{
|
|
FProperty* Prop = FindFieldChecked<FProperty>(AttributeSetClass, AttributeName);
|
|
if (Prop == nullptr)
|
|
{
|
|
return;
|
|
}
|
|
FOnGameplayAttributeValueChange &OnAttributeChange = GetGameplayAttributeValueChangeDelegate(Prop);
|
|
|
|
OnAttributeChange.AddLambda([AttributeName, Delegate](const FOnAttributeChangeData& Data)
|
|
{
|
|
Delegate.ExecuteIfBound(AttributeName, Data.NewValue, Data.OldValue);
|
|
});
|
|
}
|