Gameplay Abilities! Lesson 98!
This commit is contained in:
@@ -3,27 +3,36 @@
|
||||
|
||||
#include "UI/WidgetController/AttributeMenuWidgetController.h"
|
||||
#include "AbilitySystem/Data/AttributeInfo.h"
|
||||
#include "AuraGameplayTags.h"
|
||||
#include "AbilitySystem/AuraAttributeSet.h"
|
||||
|
||||
void UAttributeMenuWidgetController::BindCallbacksToDependencies()
|
||||
{
|
||||
|
||||
}
|
||||
void UAttributeMenuWidgetController::BindCallbacksToDependencies()
|
||||
{
|
||||
UAuraAttributeSet* AS = CastChecked<UAuraAttributeSet>(AttributeSet);
|
||||
check(AttributeInfo);
|
||||
for (auto& Pair : AS->TagsToAttributes)
|
||||
{
|
||||
AbilitySystemComponent->GetGameplayAttributeValueChangeDelegate(Pair.Value()).AddLambda(
|
||||
[this, Pair](const FOnAttributeChangeData& Data)
|
||||
{
|
||||
BroadcastAttributeInfo(Pair.Key, Pair.Value());
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void UAttributeMenuWidgetController::BroadcastInitialValues()
|
||||
{
|
||||
UAuraAttributeSet* AS = CastChecked<UAuraAttributeSet>(AttributeSet);
|
||||
void UAttributeMenuWidgetController::BroadcastInitialValues()
|
||||
{
|
||||
UAuraAttributeSet* AS = CastChecked<UAuraAttributeSet>(AttributeSet);
|
||||
check(AttributeInfo);
|
||||
for (auto& Pair : AS->TagsToAttributes)
|
||||
{
|
||||
BroadcastAttributeInfo(Pair.Key, Pair.Value());
|
||||
}
|
||||
}
|
||||
|
||||
check(AttributeInfo);
|
||||
|
||||
FAuraAttributeInfo Info = AttributeInfo->FindAttributeInfoForTag(FAuraGameplayTags::Get().Attributes_Primary_Strength);
|
||||
Info.AttributeValue = AS->GetStrength();
|
||||
AttributeInfoDelegate.Broadcast(Info);
|
||||
}
|
||||
|
||||
void UAttributeMenuWidgetController::BroadcastAttributeInfo(const FGameplayTag& AttributeTag,
|
||||
const FGameplayAttribute& Attribute) const
|
||||
{
|
||||
|
||||
}
|
||||
void UAttributeMenuWidgetController::BroadcastAttributeInfo(const FGameplayTag& AttributeTag, const FGameplayAttribute& Attribute) const
|
||||
{
|
||||
FAuraAttributeInfo Info = AttributeInfo->FindAttributeInfoForTag(AttributeTag);
|
||||
Info.AttributeValue = Attribute.GetNumericValue(AttributeSet);
|
||||
AttributeInfoDelegate.Broadcast(Info);
|
||||
}
|
||||
Reference in New Issue
Block a user