HealthBar

This commit is contained in:
2025-08-06 00:55:06 +02:00
parent ab75e6400e
commit 5afbf04037
4 changed files with 206 additions and 6 deletions

View File

@@ -9,6 +9,10 @@ public class PlayerSkillTree
private static PlayerSkillTree _instance;
private Dictionary<PotionHandler.PotionType, PotionHandler> potionHandlers = new Dictionary<PotionHandler.PotionType, PotionHandler>();
private int health = 100;
private int maxHealth = 100;
public int MaxHealth { get => maxHealth; set => maxHealth = value; }
public static PlayerSkillTree Instance
{
@@ -81,6 +85,25 @@ public class PlayerSkillTree
return false;
}
public int GetHealth() { return health; }
public void SetHealth(int value)
{
if(value + health > maxHealth)
{
health = maxHealth;
return;
}
if(health + value < 0)
{
health = 0;
return;
}
health += value;
}
public bool IsSkillUnlocked(Skills skill)
{