movement and dialogue system
This commit is contained in:
parent
977e666577
commit
1590b5faa6
123 changed files with 62825 additions and 355 deletions
32
Assets/Scripts/Entity/CombatEntity.cs
Normal file
32
Assets/Scripts/Entity/CombatEntity.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class CombatEntity : Entity
|
||||
{
|
||||
[Header("Health")]
|
||||
public float maxHealth;
|
||||
public float health;
|
||||
public bool invulnerable;
|
||||
|
||||
public void TakeDamage(float damage)
|
||||
{
|
||||
if (!invulnerable)
|
||||
{
|
||||
health -= damage;
|
||||
if (health <= 0)
|
||||
{
|
||||
OnDeath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnDeath()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Heal(float healing)
|
||||
{
|
||||
health += healing;
|
||||
health = Mathf.Clamp(health, 0, maxHealth);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue