(client) feat:实体的手动控制

This commit is contained in:
m0_75251201
2025-07-21 13:54:08 +08:00
parent a48ccca5f4
commit 6b7ddbbd40
14 changed files with 321 additions and 35 deletions

View File

@ -1,12 +1,13 @@
using Base;
using Unity.VisualScripting;
using UnityEngine;
namespace AI
{
public abstract class JobBase
{
public Entity.Entity entity;
private int timeoutTicks = 1000;
private int timeoutTicks = 100;
public bool Running=>timeoutTicks > 0;
public virtual void StartJob(Entity.Entity target)
@ -33,6 +34,28 @@ namespace AI
timeoutTicks = 0;
}
}
public class WanderJob : JobBase
{
public override void StartJob(Entity.Entity target)
{
base.StartJob(target);
Vector3 move=new(Random.Range(-10,10), Random.Range(-10,10));
var targetPosition=entity.transform.position+move;
entity.SetTarget(targetPosition);
entity.IsChase = false;
}
protected override void UpdateJob()
{
entity.TryMove();
}
override public void StopJob()
{
base.StopJob();
entity.IsChase = true;
}
}
}