public override void HandleAction(HSMAction action) { base.HandleAction(action); if (action is GameSelectedAction gameSelectedAction) { this.CurrentGame = this.Games[gameSelectedAction.Index]; SwitchState(this.gameState); action.SetHandled(); } else if (action is ExitGameAction) { this.CurrentGame = null; SwitchState(this.menuState); action.SetHandled(); } else if (action is HomeAction) { this.CurrentGame = null; SwitchState(this.menuState); action.SetHandled(); } }
public override void HandleAction(HSMAction action) { base.HandleAction(action); if (action is TaskViewReadyAction) { // Grafika je zobrazena, teď vygenerujeme akci pro mluvení myšáka s úvodními instrukcemi // (pokud se jedná o první task v řadě, což zjistíme dotazem modelu na úrovni IGame): if (GetModel <IGame>().IsFirstTask) { CreateAction <PlayMouseSpeechAction>().WithSpeech(this.introSpeech).Dispatch(); } else { CreateAction <TaskReadyAction>().Dispatch(); } // ... a pokud myšák mluví, počkáme, až domluví (MouseSpeechFinishedAction) action.SetHandled(); } else if (action is MouseSpeechFinishedAction) { if (((MouseSpeechFinishedAction)action).Speech == this.introSpeech) { CreateAction <TaskReadyAction>().Dispatch(); } action.SetHandled(); } }
public override void HandleAction(HSMAction action) { base.HandleAction(action); if (action is TaskReadyAction) { SwitchState(this.inputState); action.SetHandled(); } else if (action is ThingSelectedAction thingSelectedAction) { this.IsSuccess = thingSelectedAction.Index == this.CurrentGameTask.CorrectThingIndex; SwitchState(this.resultState); action.SetHandled(); } else if (action is TaskResultFinishedAction) { SwitchState(this.finishState); action.SetHandled(); } else if (action is TaskViewFinishedAction) { CreateAction <TaskFinishedAction>().WithSuccess(this.IsSuccess).Dispatch(); action.SetHandled(); } }
public override void HandleAction(HSMAction action) { base.HandleAction(action); if (action is ThingSelectedAction) { ForEachViewComponent <IDisableInput>(c => c.DisableInput()); } }
public override void HandleAction(HSMAction action) { base.HandleAction(action); if (action is TaskViewFinishedAction) { CreateAction <TaskFinishedAction>().WithSuccess(true).Dispatch(); action.SetHandled(); } }
public override void HandleAction(HSMAction action) { base.HandleAction(action); if (action is MouseSpeechFinishedAction) { CreateAction <TaskResultFinishedAction>().Dispatch(); action.SetHandled(); } }
public override void HandleAction(HSMAction action) { base.HandleAction(action); if (action is BackAction) { CreateAction <ExitTaskAction>().Dispatch(); action.SetHandled(); } }
public override void HandleAction(HSMAction action) { base.HandleAction(action); if (action is PlayMouseSpeechAction playMouseSpeechAction) { ForEachViewComponent <IPlayMouseSpeech>(c => c.PlayMouseSpeech(playMouseSpeechAction.Speech)); } else if (action is StopMouseSpeechAction) { ForEachViewComponent <IStopMouseSpeech>(c => c.StopMouseSpeech()); } }
public override void HandleAction(HSMAction action) { base.HandleAction(action); if (action is TaskSelectedAction taskSelectedAction) { this.CurrentTaskIndex = taskSelectedAction.Index; SwitchState(this.gameTaskState); action.SetHandled(); } if (action is TaskFinishedAction) { this.IsFirstTask = false; if (this.CurrentTaskIndex == this.TotalTaskCount - 1) { SwitchState(this.gameMenuState); } else { SwitchState(this.gameNextTaskState); } action.SetHandled(); } else if (action is NextTaskRequestAction) { this.CurrentTaskIndex++; SwitchState(this.gameTaskState); action.SetHandled(); } else if (action is ExitTaskAction) { SwitchState(this.gameMenuState); action.SetHandled(); } else if (action is BackAction) { CreateAction <ExitGameAction>().Dispatch(); action.SetHandled(); } }