::In the Part 14 article, the PlayerController script had stealth changes made to it that caused the player’s health to be able to exceed the maximum limit, and which made it impossible to get extra health.
To rectify this, you’ll need to make the following changes to your PlayerController script (we’re basically reverting this section to what it was in Part 13):
public int Health
{
get { return health; }
set
{
if (health != value)
{
health = Mathf.Max(value, 0);
health = Mathf.Clamp(value, 0, maxHealth);
UIManager.UpdateHealthUI(health, maxHealth, excessHealth);
}
}
}
public int ExcessHealth
{
get { return excessHealth; }
set
{
if (excessHealth != value)
{
excessHealth = Mathf.Clamp(value, 0, excessHealth);
excessHealth = Mathf.Max(value, 0);
UIManager.UpdateHealthUI(health, maxHealth, excessHealth);
}
}
}