35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
namespace GeometryTD.CustomComponent
|
|
{
|
|
internal sealed class CombatSettlementState : CombatStateBase
|
|
{
|
|
private readonly bool _isVictory;
|
|
|
|
public CombatSettlementState(
|
|
CombatSchedulerRuntime runtime,
|
|
CombatSchedulerCoordinator coordinator,
|
|
bool isVictory) : base(runtime, coordinator)
|
|
{
|
|
_isVictory = isVictory;
|
|
}
|
|
|
|
public override void OnEnter()
|
|
{
|
|
Runtime.EnemyManager.EndPhase();
|
|
Runtime.EnemyManager.CleanupTrackedEnemies();
|
|
Runtime.IsFinishAsVictory = _isVictory;
|
|
Runtime.SettlementContext = Runtime.CombatSettlementService.BuildSettlementContext(
|
|
_isVictory,
|
|
Runtime.CurrentLevel,
|
|
Runtime.EnemyManager.DefeatedEnemyCount,
|
|
Runtime.CombatRunResourceStore);
|
|
if (Runtime.SettlementContext.Flags.ShouldOpenRewardSelection)
|
|
{
|
|
Coordinator.ChangeState(new CombatRewardSelectionState(Runtime, Coordinator));
|
|
return;
|
|
}
|
|
|
|
Coordinator.ChangeState(new CombatFinishFormState(Runtime, Coordinator));
|
|
}
|
|
}
|
|
}
|