public override void Execute() { var state = Model.State; switch (state) { case BattleUIState.SelectingAction: Model.SelectedCombatant = null; UnitDeselectedSignal.Dispatch(); Model.State = BattleUIState.SelectingUnit; break; case BattleUIState.SelectingFightAction: Model.State = BattleUIState.SelectingAction; break; case BattleUIState.ForecastingCombat: Model.SelectedAttackTarget = null; Model.State = BattleUIState.SelectingAttackTarget; break; case BattleUIState.Surveying: Model.State = BattleUIState.Preparations; ShowBattlePrepSignal.Dispatch(); break; case BattleUIState.SelectingAttackTarget: case BattleUIState.SelectingMoveLocation: var combatant = Model.SelectedCombatant; var dimensions = Model.Dimensions; var worldPosition = dimensions.GetWorldPositionForGridPosition(combatant.Position); UnitSelectedSignal.Dispatch(worldPosition); Model.State = BattleUIState.SelectingAction; break; } }
private void Cleanup(BattleUIState state) { switch (state) { case BattleUIState.SelectingUnit: break; case BattleUIState.SelectingAction: HoverTileEnableSignal.Dispatch(); UnitDeselectedSignal.Dispatch(); break; case BattleUIState.SelectingFightAction: break; case BattleUIState.SelectingAttackTarget: ClearHighlightSignal.Dispatch(HighlightLevel.PlayerAttack); break; case BattleUIState.SelectingInteractTarget: ClearHighlightSignal.Dispatch(HighlightLevel.PlayerInteract); break; case BattleUIState.SelectingMoveLocation: ClearHighlightSignal.Dispatch(HighlightLevel.PlayerAttack); ClearHighlightSignal.Dispatch(HighlightLevel.PlayerMove); PathUnavailableSignal.Dispatch(); break; case BattleUIState.Fighting: HoverTileEnableSignal.Dispatch(); break; case BattleUIState.CombatantMoving: break; case BattleUIState.ForecastingCombat: FightForecastDisableSignal.Dispatch(); break; case BattleUIState.Uninitialized: break; case BattleUIState.PhaseChanging: HoverTileEnableSignal.Dispatch(); CameraUnlockSignal.Dispatch(); break; case BattleUIState.EnemyTurn: HoverTileEnableSignal.Dispatch(); CameraUnlockSignal.Dispatch(); break; case BattleUIState.ContextMenu: break; case BattleUIState.Preparations: break; case BattleUIState.Surveying: break; case BattleUIState.EventPlaying: break; default: throw new ArgumentOutOfRangeException("state", state, null); } }