#include "ZMMOAttributeComponent.h" UZMMOAttributeComponent::UZMMOAttributeComponent() { PrimaryComponentTick.bCanEverTick = false; } void UZMMOAttributeComponent::ApplySnapshot(const FZMMOAttributesSnapshot& InSnapshot) { const int32 OldHp = Current.Hp; const int32 OldSp = Current.Sp; Current = InSnapshot; OnAttributesChanged.Broadcast(Current); if (OldHp != Current.Hp || OldSp != Current.Sp) { OnHpSpChanged.Broadcast(Current.Hp, Current.Sp); } } void UZMMOAttributeComponent::ApplyHpSpUpdate(int32 NewHp, int32 NewSp) { if (Current.Hp == NewHp && Current.Sp == NewSp) { return; } Current.Hp = NewHp; Current.Sp = NewSp; OnHpSpChanged.Broadcast(Current.Hp, Current.Sp); } void UZMMOAttributeComponent::NotifyLevelUp(int32 NewBaseLevel, int32 StatusPointDelta) { // O snapshot subsequente vai trazer todos os outros campos atualizados — // aqui apenas dispara o delegate para efeitos visuais imediatos. OnLevelUp.Broadcast(NewBaseLevel, StatusPointDelta); }