void Start() { // Setup SM sm = gameObject.AddComponent <MyStateMachine>(); context = new AppFlowContext() { DebugText = DebugText, PatientSelectionDoneCallback = patientSelectionDone, DoneCallBack = goToNextState, TrackerWearDoneCallback = goToSetUpTracker, SetUpTrackerDoneCallback = goToRegistrationSample, RetryRegistrationCallback = goToRegistrationSample, RegistrationOkCallback = goToExerciseReady, FinishExerciseSameBdPartCallback = goToRegistrationSample, FinishExerciseDifferentBdPartCallback = goToChooseBodyParts, // ChooseBodyPartsDoneCallback = patientSelectionToDo, }; states = new List <IState>() { new PatientSelection().Setup(context), new ChooseBodyParts().Setup(context), new WearTracker().Setup(context), new SetUpTracker().Setup(context), new RegistrationSample().Setup(context), new ExerciseReady().Setup(context), new DoingExercise().Setup(context), new EndExercise().Setup(context), }; sm.Setup(context, states); patientSelectionToDo(); }
// Use this for initialization void Start() { // Setup SM sm = gameObject.AddComponent <MyStateMachine>(); MyContext context = new MyContext() { ContextName = "MyContext", ParentGameObject = this.gameObject, SetupDoneCallback = OnSetupDone, CustomData = CustomData, }; List <IState> states = new List <IState>() { new SetupState().Setup(context), new GameplayState().Setup(context), }; sm.Setup(context, states); // Inizio OnStart(); }