Files
BusyRabbit/Source/BusyRabbit/Private/Level/Actor/Components/BusyAbilitySystemComponent.cpp
2025-10-28 23:51:17 +08:00

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);
});
}