(client) feat:实体的手动控制
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user