53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "AttributeSet.h"
|
|
#include "AbilitySystemComponent.h"
|
|
#include "Net/UnrealNetwork.h"
|
|
#include "ManaAttributeSet.generated.h"
|
|
|
|
/**
|
|
*
|
|
*/
|
|
|
|
#define ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \
|
|
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
|
|
GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
|
|
GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
|
|
GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName)
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FAttributeChangedEvent, UAttributeSet*, AttributeSet, float, OldValue, float, NewValue);
|
|
|
|
UCLASS()
|
|
class ELISTRIA_CALLING_API UManaAttributeSet : public UAttributeSet
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UManaAttributeSet();
|
|
|
|
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, ReplicatedUsing=OnRep_Mana)
|
|
FGameplayAttributeData Mana;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, ReplicatedUsing=OnRep_MaxMana)
|
|
FGameplayAttributeData MaxMana;
|
|
|
|
ATTRIBUTE_ACCESSORS(UManaAttributeSet, Mana)
|
|
ATTRIBUTE_ACCESSORS(UManaAttributeSet, MaxMana)
|
|
|
|
UFUNCTION()
|
|
void OnRep_Mana(const FGameplayAttributeData& OldValue);
|
|
UFUNCTION()
|
|
void OnRep_MaxMana(const FGameplayAttributeData& OldValue);
|
|
|
|
UPROPERTY(BlueprintAssignable)
|
|
FAttributeChangedEvent OnManaChanged;
|
|
|
|
UPROPERTY(BlueprintAssignable)
|
|
FAttributeChangedEvent OnMaxManaChanged;
|
|
};
|