Add max health check to SetCurrentHealth

This commit is contained in:
Louis Hobbs 2023-01-13 21:14:08 +00:00
parent a90c447ce9
commit 4712d405d5

View File

@ -57,8 +57,12 @@ float UHealthComponent::GetCurrentHealth()
void UHealthComponent::SetCurrentHealth(float value)
{
// TODO: We might want to add some extra checking here
CurrentHealth = value;
if (CurrentHealth > MaxHealth)
{
CurrentHealth = MaxHealth;
}
}
void UHealthComponent::ResetHealth()