Files
UnrealEngine/Engine/Plugins/Marketplace/GasCompanion/Templates/ClassTemplates/AttributeSetClass.cpp.template
Brandyn / Techy fcc1b09210 init
2026-04-04 15:40:51 -05:00

61 lines
1.9 KiB
Plaintext
Executable File

%COPYRIGHT_LINE%
%PCH_INCLUDE_DIRECTIVE%
%MY_HEADER_INCLUDE_DIRECTIVE%
%ADDITIONAL_INCLUDE_DIRECTIVES%
#include "Net/UnrealNetwork.h"
// Sets default values
%PREFIXED_CLASS_NAME%::%PREFIXED_CLASS_NAME%()
{
// Default constructor
}
void %PREFIXED_CLASS_NAME%::PreAttributeChange(const FGameplayAttribute& Attribute, float& NewValue)
{
// This is called whenever attributes change, so for max attributes we want to scale the current totals to match
Super::PreAttributeChange(Attribute, NewValue);
// Set adjust code here
//
// Example:
//
// If a Max value changes, adjust current to keep Current % of Current to Max
//
// if (Attribute == GetMaxHealthAttribute())
// {
// AdjustAttributeForMaxChange(Health, MaxHealth, NewValue, GetHealthAttribute());
// }
}
void %PREFIXED_CLASS_NAME%::PostGameplayEffectExecute(const FGameplayEffectModCallbackData& Data)
{
Super::PostGameplayEffectExecute(Data);
FGSCAttributeSetExecutionData ExecutionData;
GetExecutionDataFromMod(Data, ExecutionData);
// Set clamping or handling or "meta" attributes here (like damages)
// Example 1: Using helpers to handle each attribute in their own methods (See GSCAttributeSet.cpp)
// if (Data.EvaluatedData.Attribute == GetHealthAttribute())
// {
// HandleHealthAttribute(ExecutionData);
// }
// Example 2: Basic example to clamp the value of an Health Attribute between 0 and another MaxHealth Attribute
// if (Data.EvaluatedData.Attribute == GetHealthAttribute())
// {
// SetHealth(FMath::Clamp(GetHealth(), 0.f, GetMaxHealth()));
// }
}
void %PREFIXED_CLASS_NAME%::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// %ATTRIBUTES_DOREPLIFETIME_DEFINITION%
}
// %ATTRIBUTES_ONREP_DEFINITION%
%ADDITIONAL_MEMBER_DEFINITIONS%