35 lines
860 B
C#
35 lines
860 B
C#
using System.Collections.Generic;
|
|
using Base;
|
|
using UnityEngine;
|
|
|
|
namespace Entity
|
|
{
|
|
public abstract class Entity:MonoBehaviour,ITick
|
|
{
|
|
public bool playerControlled = false;
|
|
public List<AIBase> aiTree=new();
|
|
public Data.AttributesDef runtimeAttributes;
|
|
public Vector3 direction;
|
|
public void Tick()
|
|
{
|
|
foreach (var aiBase in aiTree)
|
|
{
|
|
if (aiBase.Run(this))
|
|
break;
|
|
}
|
|
}
|
|
|
|
public virtual void TryAttck()
|
|
{
|
|
|
|
}
|
|
|
|
public virtual void OnHit(Entity from)
|
|
{
|
|
var hit = from.runtimeAttributes.attack - runtimeAttributes.defense;
|
|
if (hit < 0)
|
|
hit = from.runtimeAttributes.attack / 100;
|
|
runtimeAttributes.health -= hit;
|
|
}
|
|
}
|
|
} |