(client):feat:添加对列表定义读取的支持,ui管理器将对没有键的窗口也进行统一管理
This commit is contained in:
35
Client/Assets/Scripts/Entity/Entity.cs
Normal file
35
Client/Assets/Scripts/Entity/Entity.cs
Normal file
@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user