import { LoadedMachineConfiguration } from "../../src/types"; import { StateMachine } from "../../src/state-machines/state-machine"; export class VR_TUTORIAL_GAZE_NEW_STATE_MACHINE extends StateMachine { constructor(options: LoadedMachineConfiguration) { const { context } = options; super([ { "context": { "errorCounter": 0, ...context }, "id": "VR_TUTORIAL_GAZE_NEW", "initial": "ready", "states": { "DESCRIBE_GAZE": { "exit": [], "meta": { "CA": { "utterance": "DESCRIBE_GAZE_NEW" } }, "on": { "INSTANT": "ROTATE_HEAD" }, "type": "" }, "DESCRIBE_OBJECT": { "exit": [], "meta": { "CA": { "utterance": "DESCRIBE_OBJECT" } }, "on": { "INSTANT": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterLOWER3", "target": "ROTATE_HEAD" }, { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterGREATER2", "target": "GOODBYE_CA" } ] }, "type": "" }, "GAZE_HELP1": { "exit": [], "meta": { "CA": { "utterance": "GAZE_HELP1" } }, "on": { "INSTANT": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterGREATER2", "target": "GOODBYE_CA" } ], "LONG_GAZE(*)": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "", "target": "GAZE_HELP1" } ], "LONG_GAZE(target)": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "", "target": "TUTORIAL_POSITIVE_REINFORCEMENT" } ], "TIMER_TASK": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "", "target": "GAZE_HELP2" } ] }, "type": "" }, "GAZE_HELP2": { "exit": [], "meta": { "CA": { "utterance": "GAZE_HELP2" } }, "on": { "INSTANT": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "errorCounterGREATER2", "target": "GOODBYE_CA" } ], "LONG_GAZE(*)": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "", "target": "GAZE_HELP1" } ], "LONG_GAZE(target)": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "", "target": "TUTORIAL_POSITIVE_REINFORCEMENT" } ], "TIMER_TASK": [ { "actions": [ "errorCounterINCREMENT" ], "cond": "", "target": "GAZE_HELP2" } ] }, "type": "" }, "GOODBYE_CA": { "exit": [], "meta": { "CA": { "utterance": "GOODBYE_CA" }, "VR": [ { "name": "task_completed" }, { "name": "quit_my_life" } ] }, "on": { "INSTANT": "end" }, "type": "" }, "LOOK_AT": { "exit": [], "meta": { "CA": { "utterance": "GAZE_ITEM" } }, "on": { "LONG_GAZE(*)": [ { "actions": [ "errorCounterEQUAL" ], "cond": "", "target": "GAZE_HELP1" } ], "LONG_GAZE(target)": [ { "actions": [ "errorCounterEQUAL" ], "cond": "", "target": "TUTORIAL_POSITIVE_REINFORCEMENT" } ], "TIMER_TASK": [ { "actions": [ "errorCounterEQUAL" ], "cond": "", "target": "GAZE_HELP2" } ] }, "type": "" }, "ROTATE_HEAD": { "exit": [], "meta": { "CA": { "utterance": "DESCRIBE_ROTATE" } }, "on": { "AFFIRMATIVE": "LOOK_AT", "GAZE(*)": "LOOK_AT", "GAZE(target)": "LOOK_AT", "NEGATIVE": "DESCRIBE_OBJECT" }, "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_GAZE" }, "type": "" } } }, { actions: { errorCounterEQUAL: (context:any) => {context.errorCounter=0;}, errorCounterINCREMENT: (context:any) => {context.errorCounter++;} }, guards: { errorCounterGREATER2: (context:any) => {return context.errorCounter > 2;}, errorCounterLOWER3: (context:any) => {return context.errorCounter < 3;} } } ]); } }