using UnityGameFramework.Runtime; namespace GeometryTD.CustomComponent { public partial class CombatScheduler { private sealed class CombatFailedState : CombatStateBase { private readonly string _errorMessage; private readonly bool _notifyCombatNode; public CombatFailedState(CombatScheduler scheduler, string errorMessage, bool notifyCombatNode) : base(scheduler) { _errorMessage = errorMessage; _notifyCombatNode = notifyCombatNode; } public override void OnEnter() { Log.Error( "CombatScheduler failed. LevelId={0}, {1}", Scheduler._currentLevel != null ? Scheduler._currentLevel.Id : 0, _errorMessage); Scheduler._enemyManager.EndPhase(); Scheduler.CleanupAllCombatEntities(); Scheduler.CloseCombatFinishForm(); Scheduler.CloseRewardSelectForm(); if (_notifyCombatNode) { Scheduler.GameOverByFailure(); } } } } }