ReisenYoumuOuting/Assets/Scripts/Entity.cs

35 lines
594 B
C#

using System;
using System.Collections.Generic;
using UnityEngine;
public class Entity : MonoBehaviour
{
[Header("Health")]
public int health; //using int instead of float because it's a simpler game lol
public int maxHealth;
[Header("State")]
public bool isStalled;
[Header("Abilities")]
public List<Ability> abilities = new();
public void TakeDamage(int damage)
{
health -= damage;
if (health <= 0)
{
OnDeath();
}
}
public void Heal(int healing)
{
health += healing;
health = Math.Clamp(health, 0, maxHealth);
}
protected virtual void OnDeath()
{
}
}