(client) feat:完成实体生成函数,修复行为树加载错误,改进Define打印缩进

This commit is contained in:
m0_75251201
2025-07-22 14:40:24 +08:00
parent 506d0a68a8
commit a6dfbd7c68
26 changed files with 835 additions and 527 deletions

View File

@ -7,12 +7,13 @@ using UnityEngine.Serialization;
namespace Entity
{
public abstract class Entity:MonoBehaviour,ITick
public class Entity:MonoBehaviour,ITick
{
public AIBase aiTree;
public JobBase currentJob;
public AttributesDef runtimeAttributes;
public AttributesDef attributes;
public Vector3 direction;
public GameObject body;
public bool canSelect = true;
public bool IsChase { set; get; } = true;
@ -53,15 +54,15 @@ namespace Entity
/// </summary>
public virtual void TryMove()
{
transform.position+=direction * (runtimeAttributes.moveSpeed * Time.deltaTime * (IsChase ? 1 : 0.5f));
transform.position+=direction * (attributes.moveSpeed * Time.deltaTime * (IsChase ? 1 : 0.5f));
}
public virtual void OnHit(Entity from)
{
var hit = from.runtimeAttributes.attack - runtimeAttributes.defense;
var hit = from.attributes.attack - attributes.defense;
if (hit < 0)
hit = from.runtimeAttributes.attack / 100;
runtimeAttributes.health -= hit;
hit = from.attributes.attack / 100;
attributes.health -= hit;
currentJob.StopJob();
}