random stuff i forgot to commit
This commit is contained in:
parent
274af1e5a1
commit
b0625ae834
59 changed files with 7806 additions and 664 deletions
35
Assets/Scripts/Entities/Entity.cs
Normal file
35
Assets/Scripts/Entities/Entity.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
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 virtual 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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue