(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

@ -33,8 +33,12 @@ namespace AI
{
}
public class WanderNode : AIBase
public class RandomWander : AIBase
{
public override JobBase GetJob(Entity.Entity target)
{
return new WanderJob();
}
}
public class ConditionalAI : AIBase
{

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;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d2497fdaa11d3554287c58d696dab7e9