import { LoadedMachineConfiguration } from "../../src/types"; import { StateMachine } from "../../src/state-machines/state-machine"; export class VR_MOVE_ADVANCED2_STATE_MACHINE extends StateMachine { constructor(options: LoadedMachineConfiguration) { const { context } = options; super([ { "context": { "errorCounter": 0, ...context }, "id": "VR_MOVE_ADVANCED2", "initial": "ready", "states": { "DESCRIBE_MOVE": { "exit": [], "meta": { "CA": { "utterance": "DESCRIBE_MOVE_TARGET2" } }, "on": { "MOVE(target)": "TUTORIAL_POSITIVE_REINFORCEMENT", "TIMER_TASK": "ERROR_COUNTER" }, "type": "" }, "ERROR_COUNTER": { "exit": [], "meta": {}, "on": { "INSTANT": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterLOWER3", "target": "DESCRIBE_MOVE" }, { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterGREATER2", "target": "GOODBYE_CA" } ] }, "type": "" }, "GOODBYE_CA": { "exit": [], "meta": { "CA": { "utterance": "GOODBYE_CA" }, "VR": [ { "name": "task_completed" }, { "name": "quit_my_life" } ] }, "on": { "INSTANT": "end" }, "type": "" }, "INTRO_MOVE_BASICS": { "exit": [], "meta": { "CA": { "utterance": "TUTORIAL_INTRO_MOVE_3_NEW" } }, "on": { "INSTANT": "DESCRIBE_MOVE" }, "type": "" }, "TUTORIAL_POSITIVE_REINFORCEMENT": { "exit": [], "meta": { "CA": { "utterance": "TUTORIAL_POSITIVE_REINFORCEMENT" }, "VR": [ { "name": "task_completed" }, { "name": "positive_reinforcement" } ] }, "on": { "INSTANT": "end" }, "type": "" }, "end": { "exit": [], "meta": { "VR": [ { "name": "task_completed" } ] }, "on": { "INSTANT": "end" }, "type": "final" }, "ready": { "exit": [], "meta": {}, "on": { "READY": "INTRO_MOVE_BASICS" }, "type": "" } } }, { actions: { errorCounterINCREMENT: (context:any) => {context.errorCounter++;} }, guards: { errorCounterGREATER2: (context:any) => {return context.errorCounter > 2;}, errorCounterLOWER3: (context:any) => {return context.errorCounter < 3;} } } ]); } }