basic movement
This commit is contained in:
parent
aba5310742
commit
01a1278465
25 changed files with 1140 additions and 540 deletions
41
Assets/Scripts/Entity.cs
Normal file
41
Assets/Scripts/Entity.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class Entity : MonoBehaviour
|
||||
{
|
||||
[Header("Health")]
|
||||
public float health;
|
||||
public float maxHealth;
|
||||
|
||||
[Header("Movement")]
|
||||
public int maxMovement;
|
||||
|
||||
[Header("Flags")]
|
||||
public bool canMove;
|
||||
public bool invincible;
|
||||
|
||||
public void TakeDamage(float damage)
|
||||
{
|
||||
health -= damage;
|
||||
if (health <= 0)
|
||||
{
|
||||
OnKillEffects();
|
||||
}
|
||||
}
|
||||
|
||||
public void Heal(float healing)
|
||||
{
|
||||
health += healing;
|
||||
health = Mathf.Clamp(health, 0, maxHealth);
|
||||
}
|
||||
|
||||
protected virtual void OnKillEffects()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnMouseDown()
|
||||
{
|
||||
PlayerEntityMovement.instance.SelectEntity(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue