39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
namespace GeometryTD.CustomComponent
|
|
{
|
|
internal sealed class CombatSettlementState : CombatStateBase
|
|
{
|
|
private readonly string _reason;
|
|
private readonly bool _isVictory;
|
|
|
|
public CombatSettlementState(
|
|
CombatSchedulerRuntimeContext context,
|
|
CombatSchedulerFlowCoordinator flow,
|
|
string reason,
|
|
bool isVictory) : base(context, flow)
|
|
{
|
|
_reason = reason;
|
|
_isVictory = isVictory;
|
|
}
|
|
|
|
public override void OnEnter()
|
|
{
|
|
Context.EnemyManager.EndPhase();
|
|
Context.EnemyManager.CleanupTrackedEnemies();
|
|
Context.IsFinishAsVictory = _isVictory;
|
|
Context.SettlementContext = Context.SettlementFlowService.BuildSettlementContext(
|
|
_reason,
|
|
_isVictory,
|
|
Context.CurrentLevel,
|
|
Context.EnemyManager.DefeatedEnemyCount,
|
|
Context.CombatInRunResourceManager);
|
|
if (Context.SettlementContext.ShouldOpenRewardSelection)
|
|
{
|
|
Flow.Scheduler.ChangeState(new CombatRewardSelectionState(Context, Flow));
|
|
return;
|
|
}
|
|
|
|
Flow.Scheduler.ChangeState(new CombatFinishFormState(Context, Flow));
|
|
}
|
|
}
|
|
}
|