virtual void PreAttributeChange(const FGameplayAttribute& Attribute, float& NewValue) override;
exmple:
void UAuraAttributeSet::PreAttributeChange(const FGameplayAttribute& Attribute, float& NewValue)
{
Super::PreAttributeChange(Attribute, NewValue);

if (Attribute == GetHealthAttribute())
{
NewValue = FMath::Clamp(NewValue, 0.0f, GetMaxHealth());
}
if (Attribute == GetMaxHealthAttribute())
{
//NewValue = FMath::Clamp(NewValue, 0.0f, GetMaxHealth());
}
if (Attribute == GetManaAttribute())
{
NewValue = FMath::Clamp(NewValue, 0.0f, GetMaxMana());
}
if (Attribute == GetMaxManaAttribute())
{
//NewValue = FMath::Clamp(NewValue, 0.0f, GetMaxMana());
}
}


posted on 2025-08-27 14:28  偷懒的阿贤  阅读(15)  评论(0)    收藏  举报