refactor 4:
- CombatWaitingForPhaseEndState.cs 不再调用旧的 PhaseLoopRuntime.ShouldEndCurrentPhase(...),改为构造 PhaseEndConditionContext,再通过
PhaseEndConditionFactory.Create(currentPhase.EndType) 执行判定。
- PhaseLoopRuntime.cs 删除了旧的 phase 结束规则实现,现在只保留 phase 运行时数据管理,职责和架构文档一致。
- 为了让 BossDeadPhaseEndCondition 真正可用,我补了 boss 真值链路:
- EnemyLifecycleTracker.cs 现在会跟踪存活 boss。
- EnemyManager.cs 暴露 HasAliveBoss,并在 EntryType.Boss 刷怪时标记 boss 身份。
This commit is contained in:
+11
-5
@@ -12,7 +12,8 @@ namespace GeometryTD.CustomComponent
|
||||
{
|
||||
_ = realElapseSeconds;
|
||||
|
||||
if (Scheduler._phaseLoopRuntime.CurrentPhase == null)
|
||||
var currentPhase = Scheduler._phaseLoopRuntime.CurrentPhase;
|
||||
if (currentPhase == null)
|
||||
{
|
||||
Scheduler.EnterFailureFallback("CombatScheduler waiting phase failed. Current phase is null.");
|
||||
return;
|
||||
@@ -26,9 +27,14 @@ namespace GeometryTD.CustomComponent
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Scheduler._phaseLoopRuntime.ShouldEndCurrentPhase(
|
||||
Scheduler._enemyManager.IsPhaseSpawnCompleted,
|
||||
Scheduler._enemyManager.AliveEnemyCount))
|
||||
PhaseEndConditionContext context = new(
|
||||
currentPhase,
|
||||
Scheduler._phaseLoopRuntime.CurrentPhaseElapsed,
|
||||
Scheduler._enemyManager.IsPhaseSpawnCompleted,
|
||||
Scheduler._enemyManager.AliveEnemyCount,
|
||||
Scheduler._enemyManager.HasAliveBoss);
|
||||
IPhaseEndCondition endCondition = PhaseEndConditionFactory.Create(currentPhase.EndType);
|
||||
if (!endCondition.ShouldExit(context))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -37,4 +43,4 @@ namespace GeometryTD.CustomComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user