In this discussions Rick decides to put the logic for the difficulty in the LivesDisplay class.
For me, LivesDisplay should only do what it “says on the tin”, I instead chose to put the difficulty logic for the level in the LevelController class.
private void SetDifficulty()
{
difficulty = PlayerPrefsController.GetDifficulty();
Base playerBase = FindObjectOfType<Base>();
if (playerBase)
{
int health = playerBase.GetHealth();
Debug.Log("Player health is " + health.ToString());
int modifier = difficulty * 40;
Debug.Log("Difficulty = " + difficulty.ToString());
Debug.Log("Player health modifier = " + modifier.ToString());
health = health - modifier;
if (health <= 0) health = 1;
playerBase.SetHealth(health);
Debug.Log("Player health now = " + health.ToString());
}
}