(client) feat:实现摄像机跟踪与移动,实现任意位置生成实体,实现更安全的资源加载方式(指定unity内部加载资源) (#42)
Co-authored-by: zzdxxz <2079238449@qq.com> Co-committed-by: zzdxxz <2079238449@qq.com>
This commit is contained in:
@ -48,33 +48,17 @@ namespace AI
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public class SequentialAI : Selector
|
||||
public class SequenceAI : AIBase
|
||||
{
|
||||
private int currentIndex = 0; // 当前正在尝试的子节点索引
|
||||
|
||||
public override JobBase GetJob(Entity.Entity target)
|
||||
{
|
||||
// 如果当前索引超出了子节点范围,重置索引并返回 null
|
||||
if (currentIndex >= children.Count)
|
||||
foreach (var aiBase in children)
|
||||
{
|
||||
ResetIndex();
|
||||
return null;
|
||||
var job = aiBase.GetJob(target);
|
||||
if (job == null)
|
||||
return null; // 如果某个子节点返回 null,则整个序列失败
|
||||
}
|
||||
|
||||
// 获取当前子节点的任务
|
||||
var currentChild = children[currentIndex];
|
||||
var job = currentChild.GetJob(target);
|
||||
|
||||
// 移动到下一个子节点
|
||||
currentIndex++;
|
||||
|
||||
return job;
|
||||
}
|
||||
|
||||
// 重置当前索引(用于重新开始遍历)
|
||||
private void ResetIndex()
|
||||
{
|
||||
currentIndex = 0;
|
||||
return null; // 所有子节点完成时返回 null
|
||||
}
|
||||
}
|
||||
public class ContinuousMove : AIBase
|
||||
@ -89,7 +73,7 @@ namespace AI
|
||||
{
|
||||
public override JobBase GetJob(Entity.Entity target)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return new TrackPlayerJob();
|
||||
}
|
||||
}
|
||||
public class RandomWander : AIBase
|
||||
@ -99,5 +83,11 @@ namespace AI
|
||||
return new WanderJob();
|
||||
}
|
||||
}
|
||||
|
||||
public class Idel : AIBase
|
||||
{
|
||||
public override JobBase GetJob(Entity.Entity target)
|
||||
{
|
||||
return new IdleJob();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user