When calling takeDamage after checking it the character is dead, doesn’t show the damage this time.
So, I add a call inside the “if” to show the last hit damage amount.
public void TakeDamage(GameObject instigator, float damage)
{
Debug.Log($"{gameObject.name} took damage: {damage}");
healthPoints.value = Mathf.Max(healthPoints.value - damage, 0.0f);
if (healthPoints.value == 0.0f)
{
takeDamage.Invoke(damage);
Die();
AwardExperience(instigator);
}
else
{
takeDamage.Invoke(damage);
}
}