Sam made the variable DamageApplied
into DamageToApply
and used FMath::Min
. I’ve done the challenge like this. I’m just curious if this is ok and if I should expect to have any weird behaviours later? It’s behaving the same way at the moment, stoping at 0 health.
float AShooterCharacter::TakeDamage(float DamageAmount, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, AActor* DamageCauser)
{
float DamageApplied = Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);
Health -= DamageApplied;
Health = FMath::Clamp(Health, 0.f, MaxHealth);
UE_LOG(LogTemp, Warning, TEXT("Health: %f"), Health);
return Health;
}