Add max health check to `SetCurrentHealth`
This commit is contained in:
parent
a90c447ce9
commit
4712d405d5
|
@ -57,8 +57,12 @@ float UHealthComponent::GetCurrentHealth()
|
||||||
|
|
||||||
void UHealthComponent::SetCurrentHealth(float value)
|
void UHealthComponent::SetCurrentHealth(float value)
|
||||||
{
|
{
|
||||||
// TODO: We might want to add some extra checking here
|
|
||||||
CurrentHealth = value;
|
CurrentHealth = value;
|
||||||
|
|
||||||
|
if (CurrentHealth > MaxHealth)
|
||||||
|
{
|
||||||
|
CurrentHealth = MaxHealth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UHealthComponent::ResetHealth()
|
void UHealthComponent::ResetHealth()
|
||||||
|
|
Loading…
Reference in New Issue