Generic class of enemy & first enemy: Mayor

This commit is contained in:
2023-10-14 09:44:56 +02:00
parent ae38582ddc
commit 46664e688f
18 changed files with 878 additions and 37 deletions
+26 -2
View File
@@ -4,8 +4,9 @@ using UnityEngine;
public class PlayerManager : MonoBehaviour
{
public float Health = 100f;
public float Speed = 10f;
public int Health = 100;
public int MaxHealth = 100;
public float Speed = 2f;
public int Exp = 0;
public int Level = 1;
@@ -19,4 +20,27 @@ public class PlayerManager : MonoBehaviour
Level++;
}
}
public void TakeDamage(int value)
{
Health -= value;
if (Health < 0)
{
Health = 0;
// Death animation + menu
} else
{
// Damage animation
}
}
public void Heal(int value)
{
Health += value;
if (Health > MaxHealth)
{
Health = MaxHealth;
}
}
}