import { LoadedMachineConfiguration } from "../../src/types"; import { StateMachine } from "../../src/state-machines/state-machine"; export class VR_TUTORIAL_VOCE_STATE_MACHINE extends StateMachine { constructor(options: LoadedMachineConfiguration) { const { context } = options; super([ { "context": { "errorCounter": 0, "tutorial_voice_counter": 0, ...context }, "id": "VR_TUTORIAL_VOCE", "initial": "ready", "states": { "TUTORIAL_ASK_ME_EXIT": { "exit": [], "meta": { "CA": { "utterance": "ASK_ME_EXIT" } }, "on": { "SILENT": "TUTORIAL_NEGATIVE_REINFORCEMENT", "STRESSED": "TUTORIAL_FINAL_POSITIVE_REINFORCEMENT", "TIRED": "TUTORIAL_FINAL_POSITIVE_REINFORCEMENT" }, "type": "" }, "TUTORIAL_ASK_ME_HELP": { "exit": [], "meta": { "CA": { "utterance": "ASK_ME_HELP" } }, "on": { "ASK_HELP": "TUTORIAL_POSITIVE_REINFORCEMENT", "SILENT": "TUTORIAL_NEGATIVE_REINFORCEMENT" }, "type": "" }, "TUTORIAL_ASK_ME_WHAT": { "exit": [], "meta": { "CA": { "utterance": "ASK_ME_WHAT" } }, "on": { "ASK_WHAT": "TUTORIAL_POSITIVE_REINFORCEMENT", "SILENT": "TUTORIAL_NEGATIVE_REINFORCEMENT" }, "type": "" }, "TUTORIAL_ASK_ME_WHERE": { "exit": [], "meta": { "CA": { "utterance": "ASK_ME_WHERE" } }, "on": { "ASK_WHERE": "TUTORIAL_POSITIVE_REINFORCEMENT", "SILENT": "TUTORIAL_NEGATIVE_REINFORCEMENT" }, "type": "" }, "TUTORIAL_FINAL_POSITIVE_REINFORCEMENT": { "exit": [], "meta": { "CA": { "utterance": "TUTORIAL_FINAL_POSITIVE_REINFORCEMENT" }, "VR": [ { "name": "task_completed" }, { "name": "positive_reinforcement" } ] }, "on": { "INSTANT": "end" }, "type": "" }, "TUTORIAL_INTRO_VOCE": { "exit": [], "meta": { "CA": { "utterance": "TUTORIAL_INTRO_VOICE" } }, "on": { "INSTANT": "TUTORIAL_ASK_ME_HELP" }, "type": "" }, "TUTORIAL_NEGATIVE_REINFORCEMENT": { "exit": [], "meta": { "CA": { "utterance": "NEGATIVE_REINFORCEMENT" }, "VR": [ { "name": "negative_reinforcement" } ] }, "on": { "INSTANT": [ { "actions": [ "" ], "cond": "tutorial_voice_counterEQUAL0", "target": "TUTORIAL_ASK_ME_HELP" }, { "actions": [ "" ], "cond": "tutorial_voice_counterEQUAL1", "target": "TUTORIAL_ASK_ME_WHAT" }, { "actions": [ "" ], "cond": "tutorial_voice_counterEQUAL2", "target": "TUTORIAL_ASK_ME_WHERE" }, { "actions": [ "" ], "cond": "tutorial_voice_counterEQUAL3", "target": "TUTORIAL_ASK_ME_EXIT" } ] }, "type": "" }, "TUTORIAL_POSITIVE_REINFORCEMENT": { "exit": [], "meta": { "CA": { "utterance": "TUTORIAL_POSITIVE_REINFORCEMENT" }, "VR": [ { "name": "positive_reinforcement" } ] }, "on": { "INSTANT": [ { "actions": [ "tutorial_voice_counterINCREMENT" ], "cond": "tutorial_voice_counterEQUAL1", "target": "TUTORIAL_ASK_ME_WHAT" }, { "actions": [ "" ], "cond": "tutorial_voice_counterEQUAL2", "target": "TUTORIAL_ASK_ME_WHERE" }, { "actions": [ "" ], "cond": "tutorial_voice_counterEQUAL3", "target": "TUTORIAL_ASK_ME_EXIT" } ] }, "type": "" }, "end": { "exit": [], "meta": { "VR": [ { "name": "task_completed" } ] }, "on": { "INSTANT": "end" }, "type": "final" }, "ready": { "exit": [], "meta": {}, "on": { "READY": "TUTORIAL_INTRO_VOCE" }, "type": "" } } }, { actions: { tutorial_voice_counterINCREMENT: (context:any) => {context.tutorial_voice_counter++;} }, guards: { tutorial_voice_counterEQUAL0: (context:any) => {return context.tutorial_voice_counter === 0;}, tutorial_voice_counterEQUAL1: (context:any) => {return context.tutorial_voice_counter === 1;}, tutorial_voice_counterEQUAL2: (context:any) => {return context.tutorial_voice_counter === 2;}, tutorial_voice_counterEQUAL3: (context:any) => {return context.tutorial_voice_counter === 3;} } } ]); } }