ResourceFull 未挂 BossResource 时改为显式抛——原先静默返回 false, 是 CLAUDE.md 第 6 条禁止的下游兜底,且与紧邻的 Boss facet 行为不一致。 FakeBossControl.DistanceToAnchor 不再忽略 index。测试改用 TearDown 清理 (本项目关闭了 Domain/Scene Reload,失败断言会把物体永久留在打开的场景里)。 BeginPhaseTransition 去掉死的默认参数;接口补充重入契约说明。 顺带去重:FakeAiContext 实现 IEnemyActor,删除两个测试内的本地 Ctx 副本 ——一个接口成员改动要同步三份是复发性成本。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using BaseGames.AI;
|
|
|
|
namespace BaseGames.Tests.EditMode.AI
|
|
{
|
|
public sealed class FakeBossControl : IBossControl
|
|
{
|
|
public int Phase;
|
|
public bool Transitioning;
|
|
public bool Full;
|
|
|
|
// 记录最近一次过渡请求,供断言"图确实发起了过渡"
|
|
public int LastTargetPhase = -1;
|
|
public float LastDuration = -1f;
|
|
public int BeginCallCount;
|
|
|
|
// 锚点:测试按下标直给坐标;距离由 SelfPosition 与该下标锚点算出(不忽略 index)
|
|
public UnityEngine.Vector2[] Anchors = new UnityEngine.Vector2[0];
|
|
public UnityEngine.Vector2 SelfPosition;
|
|
|
|
public int CurrentPhase => Phase;
|
|
public bool IsPhaseTransitioning => Transitioning;
|
|
public bool ResourceFull => Full;
|
|
|
|
public void BeginPhaseTransition(int targetPhase, float invincibleDuration)
|
|
{
|
|
LastTargetPhase = targetPhase;
|
|
LastDuration = invincibleDuration;
|
|
BeginCallCount++;
|
|
Transitioning = true; // 由测试手工置回 false 模拟过渡结束
|
|
}
|
|
|
|
public UnityEngine.Vector2 AnchorAt(int index) => Anchors[index];
|
|
public float DistanceToAnchor(int index)
|
|
=> UnityEngine.Vector2.Distance(SelfPosition, Anchors[index]);
|
|
}
|
|
}
|