2024-04-21 15:56:57 -07:00
|
|
|
// Generated by GasaGen/GasaGen_UGasaAttributeSet.cpp
|
2024-04-13 13:18:57 -07:00
|
|
|
#include "GasaAttributeSet.h"
|
2024-04-21 15:56:57 -07:00
|
|
|
#include "GasaAttributeSet_Inlines.h"
|
2024-04-13 07:19:45 -07:00
|
|
|
|
2024-04-13 13:18:57 -07:00
|
|
|
#include "AbilitySystemComponent.h"
|
|
|
|
#include "Net/UnrealNetwork.h"
|
|
|
|
#include "Networking/GasaNetLibrary.h"
|
|
|
|
|
|
|
|
UGasaAttributeSet::UGasaAttributeSet()
|
|
|
|
{
|
2024-04-24 15:18:26 -07:00
|
|
|
InitHealth( 100.f );
|
2024-04-13 15:35:19 -07:00
|
|
|
InitMaxHealth( 100.f );
|
2024-04-24 15:18:26 -07:00
|
|
|
InitMana( 50.f );
|
2024-04-13 15:35:19 -07:00
|
|
|
InitMaxMana( 50.f );
|
2024-04-13 13:18:57 -07:00
|
|
|
}
|
|
|
|
|
2024-04-22 22:10:02 -07:00
|
|
|
#pragma region Rep Notifies
|
2024-04-13 13:18:57 -07:00
|
|
|
void UGasaAttributeSet::Client_OnRep_Health( FGameplayAttributeData& PrevHealth )
|
|
|
|
{
|
2024-04-22 09:01:30 -07:00
|
|
|
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
|
|
|
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Health ) );
|
|
|
|
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Health, PrevHealth );
|
2024-04-13 13:18:57 -07:00
|
|
|
}
|
|
|
|
void UGasaAttributeSet::Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth )
|
|
|
|
{
|
2024-04-22 09:01:30 -07:00
|
|
|
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
|
|
|
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxHealth ) );
|
|
|
|
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), MaxHealth, PrevMaxHealth );
|
2024-04-13 13:18:57 -07:00
|
|
|
}
|
|
|
|
void UGasaAttributeSet::Client_OnRep_Mana( FGameplayAttributeData& PrevMana )
|
|
|
|
{
|
2024-04-22 09:01:30 -07:00
|
|
|
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
|
|
|
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Mana ) );
|
|
|
|
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Mana, PrevMana );
|
2024-04-13 13:18:57 -07:00
|
|
|
}
|
|
|
|
void UGasaAttributeSet::Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana )
|
|
|
|
{
|
2024-04-22 09:01:30 -07:00
|
|
|
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
|
|
|
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxMana ) );
|
|
|
|
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), MaxMana, PrevMaxMana );
|
2024-04-13 13:18:57 -07:00
|
|
|
}
|
2024-04-22 09:01:30 -07:00
|
|
|
#pragma endregion Rep Notifies
|
2024-04-22 22:10:02 -07:00
|
|
|
|
2024-04-24 15:18:26 -07:00
|
|
|
void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute, float& NewValue )
|
|
|
|
{
|
|
|
|
Super::PreAttributeChange( Attribute, NewValue );
|
|
|
|
|
|
|
|
if ( Attribute == GetHealthAttribute() )
|
|
|
|
{
|
|
|
|
NewValue = FMath::Clamp( NewValue, 0, GetMaxHealth() );
|
|
|
|
}
|
|
|
|
if ( Attribute == GetMaxHealthAttribute() )
|
|
|
|
{
|
|
|
|
NewValue = FMath::Clamp( NewValue, 0, 99999.000000 );
|
|
|
|
}
|
|
|
|
if ( Attribute == GetManaAttribute() )
|
|
|
|
{
|
|
|
|
NewValue = FMath::Clamp( NewValue, 0, GetMaxMana() );
|
|
|
|
}
|
|
|
|
if ( Attribute == GetMaxManaAttribute() )
|
|
|
|
{
|
|
|
|
NewValue = FMath::Clamp( NewValue, 0, 99999.000000 );
|
|
|
|
}
|
|
|
|
}
|
2024-04-21 06:51:51 -07:00
|
|
|
void UGasaAttributeSet::GetLifetimeReplicatedProps( TArray<FLifetimeProperty>& OutLifetimeProps ) const
|
2024-04-13 13:18:57 -07:00
|
|
|
{
|
|
|
|
Super::GetLifetimeReplicatedProps( OutLifetimeProps );
|
2024-04-21 06:51:51 -07:00
|
|
|
|
2024-04-13 13:18:57 -07:00
|
|
|
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Health );
|
|
|
|
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxHealth );
|
|
|
|
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Mana );
|
|
|
|
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxMana );
|
|
|
|
}
|