refactor(enemy): 退役 PerceptionStateMachine,E001 切换到两层模块组装

This commit is contained in:
2026-07-29 14:24:48 +08:00
parent 9dc10e0398
commit 7327a5fe09
5 changed files with 8 additions and 693 deletions
@@ -3,35 +3,17 @@ using BaseGames.AI;
namespace BaseGames.Enemies
{
/// <summary>
/// E001(草蛭)AI —— 纯决策层,复用 PerceptionStateMachine 的"待机/警觉/追击/巡逻"统一规则
/// 只声明差异:每个状态触发哪个能力(待机=伪装静止、巡逻=游走、警觉=张口、追击=接触追击)。
/// AI 只决策(进哪个状态/转换条件/触发哪个能力);移动/朝向/停/速度/动画/伤害/阶段声明全部在能力里实现
/// 依据 Docs/Game/Design/小怪设计-程序开发文档-01.md
/// E001(草蛭)AI —— 纯决策层,组装两层模块
/// 出生伪装静止(伪装成石头),一旦交战过就只回巡逻;追击=带冷却的接触冲锋,
/// 起手即锁定、打完回巡逻走冷却;死亡演出走物理状态机(EnemyBase.PerformDeath
/// AI 只决策;移动 / 朝向 / 速度 / 动画 / 伤害全部在能力与 EnemyLocomotion 里实现
/// 依据 Docs/Game/敌人/小怪/E001_草蛭.md。
/// </summary>
[AiDefinition("E001")]
public sealed class E001CaoZhiAi : AiScript
{
protected override void Build(BrainBuilder b)
{
PerceptionStateMachine.Add(b, new PerceptionStateMachine.Config
{
Idle = "Idle_Disguise",
Patrol = "Move_Patrol",
Alert = "Alert",
Chase = "Chase",
Death = "Death",
// [临时调试] 出生即巡逻,用于真机验证"中心悬空导致导航寻路失效"是否真实存在。
// 验证完成后必须改回 "Idle_Disguise"(伪装静止)。
Entry = "Move_Patrol",
Rest = "Move_Patrol",
IdleMode = LocomotionMode.Idle,
PatrolMode = LocomotionMode.Patrol,
AlertMode = LocomotionMode.Face,
ChaseAbilityId = "e001_chase",
PatrolBetweenChases = true, // 冲刺=带冷却的冲锋:冲完→CD 期巡逻→冷却结束仍在追逐区→再冲
// DeathAbilityId 留空:死亡演出走物理状态机(EnemyBase.PerformDeath)
});
}
protected override void Build(BrainBuilder b) => PerceptionSkeleton.Add(b,
unaware: new DisguiseThenPatrol(),
engagement: new RushEngagement("e001_chase", RushExit.Committed));
}
}