// Fill out your copyright notice in the Description page of Project Settings. #include "HealOverTime.h" #include "the_twilight_abyss/PlayerTemp/TempCharacter.h" void UHealOverTime::Heal(AActor* Character, const float Amount) const { if (ATempCharacter* CastedCharacter = Cast(Character); CastedCharacter->Health < 100) { CastedCharacter->Health += Amount; } else { CastedCharacter->Health = 100; } } void UHealOverTime::Invoke(AActor* Character, float TimeOfExpiry) { Super::Invoke(Character, TimeOfExpiry); GetWorld()->GetTimerManager().SetTimer(HealTimerHandle, [this, Character] { Heal(Character, 1); }, 1, true, 0); } void UHealOverTime::OnExpiry(AActor* Character) { GetWorld()->GetTimerManager().ClearTimer(HealTimerHandle); Super::OnExpiry(Character); }