private void ProcessActions(List <ICombatAction> actions, IActionPlan plan) { if (actions.Count > 0) { var nextAction = actions[0]; var poiFactory = new PointOfInterestFactory(BattleViewState.Dimensions); var poi = nextAction.GetPointofInterest(poiFactory); Action panListener = null; panListener = new Action(() => { Action listener = null; listener = new Action(() => { ProcessActions(actions.Skip(1).ToList(), plan); ActionCompleteSignal.RemoveListener(listener); }); ActionCompleteSignal.AddListener(listener); AnimateActionSignal.Dispatch(nextAction); CameraPanCompleteSignal.RemoveListener(panListener); }); CameraPanCompleteSignal.AddListener(panListener); PanToPointOfInterestSignal.Dispatch(poi); } else if (plan.HasActionsRemaining()) { ProcessActions(plan.NextActionStep(BattleViewState.Battle), plan); } else { Release(); EnemyTurnCompleteSignal.Dispatch(); } }
public override void Execute() { Model.State = BattleUIState.EventPlaying; Model.EventsThisActionPhase.Add(Tile.EventName); var poiFactory = new PointOfInterestFactory(Model.Dimensions); var interaction = new InteractAction(Tile, Model.SelectedCombatant, Model.Map); var pointOfInterest = interaction.GetPointofInterest(poiFactory); Retain(); Action panListener = null; panListener = new Action(() => { Release(); CameraPanCompleteSignal.RemoveListener(panListener); ActionAnimationCompleteSignal.Dispatch(new InteractAction(Tile, Model.SelectedCombatant, Model.Map)); }); CameraPanCompleteSignal.AddListener(panListener); PanToPointOfInterestSignal.Dispatch(pointOfInterest); }