Files
Aura/Source/Aura/Private/UI/WidgetController/AttributeMenuController.cpp
2024-03-20 16:21:19 +01:00

42 lines
1.2 KiB
C++

// Amasson
#include "UI/WidgetController/AttributeMenuController.h"
#include "AbilitySystem/AuraAbilitySystemComponent.h"
#include "AbilitySystem/AuraAttributeSet.h"
#include "AbilitySystem/Data/AttributeInfo.h"
#include "AbilitySystem/Components/PerkPointsComponent.h"
#include "Player/AuraPlayerState.h"
#include "UI/WidgetController/Components/AttributeSetWCComponent.h"
#include "UI/WidgetController/Components/PerkPointsWCComponent.h"
void UAttributeMenuController::Construct()
{
Super::Construct();
AttributeSetWcc = AddComponent<UAttributeSetWCComponent>("AttributeSet");
PerkPointsWcc = AddComponent<UPerkPointsWCComponent>("PerkPoints");
}
void UAttributeMenuController::ObservedActorSet()
{
Super::ObservedActorSet();
UPerkPointsComponent* PerkPoints = IsValid(AuraPlayerState) ? AuraPlayerState->GetPerkPoints() : nullptr;
if (IsValid(AttributeSetWcc))
AttributeSetWcc->Initialize(AuraAbilitySystemComponent, AuraAttributeSet, AttributeInfo);
if (IsValid(PerkPointsWcc))
PerkPointsWcc->Initialize(PerkPoints);
}
void UAttributeMenuController::UpgradeAttribute(FGameplayTag AttributeTag)
{
if (IsValid(AuraPlayerState))
{
AuraPlayerState->Server_SpendAttributesPoint(1, AttributeTag);
}
}