import { LoadedMachineConfiguration } from "../../src/types"; import { StateMachine } from "../../src/state-machines/state-machine"; export class VR_TUTORIAL_SELECT_SIMPLE_NEW_STATE_MACHINE extends StateMachine { constructor(options: LoadedMachineConfiguration) { const { context } = options; super([ { "context": { "errorCounter": 0, ...context }, "id": "VR_TUTORIAL_SELECT_SIMPLE_NEW", "initial": "ready", "states": { "DESCRIBE_SELECT": { "exit": [], "meta": { "CA": { "utterance": "DESCRIBE_SELECT_NEW" } }, "on": { "INSTANT": "SELECT_ITEM" }, "type": "" }, "GOODBYE_CA": { "exit": [], "meta": { "CA": { "utterance": "GOODBYE_CA" }, "VR": [ { "name": "task_completed" }, { "name": "quit_my_life" } ] }, "on": { "INSTANT": "end" }, "type": "" }, "SELECT_HELP1": { "exit": [], "meta": { "CA": { "utterance": "SELECT_HELP1" } }, "on": { "INSTANT": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterEQUAL2", "target": "SPOTLIGHT1" }, { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterGREATER2", "target": "GOODBYE_CA" } ], "SELECT(*)": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "", "target": "SELECT_HELP1" } ], "SELECT(target)": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "", "target": "TUTORIAL_POSITIVE_REINFORCEMENT" } ], "TIMER_TASK": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "", "target": "SELECT_HELP2" } ] }, "type": "" }, "SELECT_HELP2": { "exit": [], "meta": { "CA": { "utterance": "SELECT_HELP2" } }, "on": { "INSTANT": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterEQUAL2", "target": "SPOTLIGHT2" }, { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterGREATER2", "target": "GOODBYE_CA" } ], "SELECT(*)": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "", "target": "SELECT_HELP1" } ], "SELECT(target)": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "", "target": "TUTORIAL_POSITIVE_REINFORCEMENT" } ], "TIMER_TASK": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "", "target": "SELECT_HELP2" } ] }, "type": "" }, "SELECT_ITEM": { "exit": [], "meta": { "CA": { "utterance": "SELECT_ITEM" }, "VR": [ { "name": "Freccia" } ] }, "on": { "SELECT(*)": [ { "actions": [ "errorCounterEQUAL" ], "cond": "", "target": "SELECT_HELP1" } ], "SELECT(target)": [ { "actions": [ "errorCounterEQUAL" ], "cond": "", "target": "TUTORIAL_POSITIVE_REINFORCEMENT" } ], "TIMER_TASK": [ { "actions": [ "errorCounterEQUAL" ], "cond": "", "target": "SELECT_HELP2" } ] }, "type": "" }, "SPOTLIGHT1": { "exit": [], "meta": { "VR": [ { "name": "Spotlight" } ] }, "on": { "INSTANT": "SELECT_HELP1" }, "type": "" }, "SPOTLIGHT2": { "exit": [], "meta": { "VR": [ { "name": "Spotlight" } ] }, "on": { "INSTANT": "SELECT_HELP2" }, "type": "" }, "TUTORIAL_POSITIVE_REINFORCEMENT": { "exit": [], "meta": { "CA": { "utterance": "TUTORIAL_POSITIVE_FEEDBACK" }, "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": "DESCRIBE_SELECT" }, "type": "" } } }, { actions: { errorCounterEQUAL: (context:any) => {context.errorCounter=0;}, errorCounterINCREMENT: (context:any) => {context.errorCounter++;} }, guards: { errorCounterEQUAL2: (context:any) => {return context.errorCounter === 2;}, errorCounterGREATER2: (context:any) => {return context.errorCounter > 2;} } } ]); } }