fixed delayed healing adding additional timers on each damage event

This commit is contained in:
2025-12-05 01:31:57 -05:00
parent fcacd2020a
commit 89de109296
2 changed files with 6 additions and 5 deletions

View File

@@ -12,8 +12,8 @@ UDDIHealth::UDDIHealth()
MaxHealth = 0; MaxHealth = 0;
CurrentHealth = 0; CurrentHealth = 0;
ClassName = ClassNames::Scout; ClassName = ClassNames::Scout;
HealTickTime = 0.2f; HealTickTime = 1.f;
HealDelayTime = 1.5f; HealDelayTime = 2.f;
} }
@@ -70,7 +70,7 @@ void UDDIHealth::Heal()
if (CurrentHealth >= MaxHealth) if (CurrentHealth >= MaxHealth)
{ {
CurrentHealth = MaxHealth; CurrentHealth = MaxHealth;
HealTimer.Invalidate(); GetWorld()->GetTimerManager().ClearTimer(HealTimer);
return; return;
} }
@@ -81,8 +81,9 @@ void UDDIHealth::Heal()
// Called to cause damage // Called to cause damage
void UDDIHealth::TakeDamage(int DamageValue) void UDDIHealth::TakeDamage(int DamageValue)
{ {
if (HealTimer.IsValid()) // if (HealTimer.IsValid())
HealTimer.Invalidate(); // HealTimer.Invalidate();
GetWorld()->GetTimerManager().ClearTimer(HealTimer);
CurrentHealth -= DamageValue; CurrentHealth -= DamageValue;