import { LoadedMachineConfiguration } from "../../src/types"; import { StateMachine } from "../../src/state-machines/state-machine"; export class VR_TUTORIAL_MOVE_ALT1_STATE_MACHINE extends StateMachine { constructor(options: LoadedMachineConfiguration) { const { context } = options; super([ { "context": { "errorCounter": 0, ...context }, "id": "VR_TUTORIAL_MOVE_ALT1", "initial": "ready", "states": { "DESCRIBE_MOVE": { "exit": [], "meta": { "CA": { "utterance": "DESCRIBE_MOVE_TARGET_4" } }, "on": { "MOVE(target)": "TUTORIAL_POSITIVE_REINFORCEMENT", "STOP_MOVE_SIGHT": "DESCRIBE_STOP_MOVE", "STOP_MOVE_TRIGGER": "DESCRIBE_STOP_MOVE", "TIMER_TASK": "ERROR_COUNTER1" }, "type": "" }, "DESCRIBE_SELECT_TARGET": { "exit": [], "meta": { "CA": { "utterance": "DESCRIBE_MOVE_SELECT_TARGET" }, "VR": [ { "name": "Freccia" } ] }, "on": { "SELECT(target)": "DESCRIBE_MOVE", "TIMER_TASK": "ERROR_COUNTER2" }, "type": "" }, "DESCRIBE_STOP_MOVE": { "exit": [], "meta": { "CA": { "utterance": "DESCRIBE_STOP_MOVE" } }, "on": { "RESTART_MOVE": "RESUME_MOVE", "TIMER_TASK": "ERROR_COUNTER3" }, "type": "" }, "ERROR_COUNTER1": { "exit": [], "meta": {}, "on": { "INSTANT": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterLOWER3", "target": "DESCRIBE_MOVE" }, { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterGREATER2", "target": "GOODBYE_CA" } ] }, "type": "" }, "ERROR_COUNTER2": { "exit": [], "meta": {}, "on": { "INSTANT": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterLOWER3", "target": "DESCRIBE_SELECT_TARGET" }, { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterGREATER2", "target": "GOODBYE_CA" } ] }, "type": "" }, "ERROR_COUNTER3": { "exit": [], "meta": {}, "on": { "INSTANT": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterLOWER3", "target": "DESCRIBE_STOP_MOVE" }, { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterGREATER2", "target": "GOODBYE_CA" } ] }, "type": "" }, "GOODBYE_CA": { "exit": [], "meta": { "CA": { "utterance": "GOODBYE_CA" }, "VR": [ { "name": "task_completed" } ] }, "on": { "INSTANT": "end" }, "type": "" }, "INTO_MOVE_BASICS": { "exit": [], "meta": { "CA": { "utterance": "TUTORIAL_INTRO_MOVE_4" } }, "on": { "INSTANT": "DESCRIBE_SELECT_TARGET" }, "type": "" }, "RESUME_MOVE": { "exit": [], "meta": { "CA": { "utterance": "RESUME_MOVE" } }, "on": { "MOVE(target)": "TUTORIAL_POSITIVE_REINFORCEMENT", "STOP_MOVE_SIGHT": "DESCRIBE_STOP_MOVE", "STOP_MOVE_TRIGGER": "DESCRIBE_STOP_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": "INTO_MOVE_BASICS" }, "type": "" } } }, { actions: { errorCounterINCREMENT: (context:any) => {context.errorCounter++;} }, guards: { errorCounterGREATER2: (context:any) => {return context.errorCounter > 2;}, errorCounterLOWER3: (context:any) => {return context.errorCounter < 3;} } } ]); } }