void Start() { // Grab the mesh renderer that's on the same object as this script. meshRenderer = this.gameObject.GetComponentInChildren <MeshRenderer>(); handIsShown = false; InteractionManager.InteractionSourceDetected += InteractionManager_SourceDetected; InteractionManager.InteractionSourceLost += InteractionManager_SourceLost; gazeManager = HTGazeManager.Instance; }
// Use this for initialization void Start() { customMessages = CustomMessages.Instance; if (customMessages != null) { customMessages.MessageHandlers[CustomMessages.TestMessageID.SetPositionOfGazeMarker] = SetPositionOfGazeMarkerMessageReceived; customMessages.MessageHandlers[CustomMessages.TestMessageID.ClearGazeMarker] = ClearGazeMarkerMessageReceived; } markerRenderer = Marker.GetComponent <MeshRenderer>(); markerRenderer.enabled = false; state = this.GetComponent <StateAccessor>(); //this dependency might be dangerous gazeManager = HTGazeManager.Instance; soundFX = gameObject.GetComponent <AudioSource>(); }
private void LoadEnterSessionIDScene() { HTGazeManager gazeManager = HTGazeManager.Instance; if (gazeManager.Hit) { WriteAdjustmentAngle(gazeManager.Position); } else { PlayerPrefs.SetFloat("adjustmentAngle", 0.0f); } PushSceneName("StudentOrSoloScene"); SceneManager.LoadScene("EnterSessionIDScene", LoadSceneMode.Single); }
private void LoadStudentOrSoloScene() { Scene currentScene = SceneManager.GetActiveScene(); Debug.Log("Inside LoadStudentOrSoloScene()"); HTGazeManager gazeManager = HTGazeManager.Instance; if (gazeManager.Hit) { WriteAdjustmentAngle(gazeManager.Position); } else { PlayerPrefs.SetFloat("adjustmentAngle", 0.0f); } PushSceneName("StartAppScene"); SceneManager.LoadScene("StudentOrSoloScene", LoadSceneMode.Single); }
private void HandleBackButton() { string currentScene = SceneManager.GetActiveScene().name; Debug.Log("In HandleBackButton()"); Debug.Log("Top of stack is " + sceneStack.Peek()); HTGazeManager gazeManager = HTGazeManager.Instance; if (gazeManager.Hit) { WriteAdjustmentAngle(gazeManager.Position); } else { PlayerPrefs.SetFloat("adjustmentAngle", 0.0f); } SceneManager.LoadScene(PopSceneName(), LoadSceneMode.Single); }
// Use this for initialization void Start() { // Referencing game objects to access their scripts brain = GameObject.Find(BRAIN_GAME_OBJECT_NAME); brainStructures = GameObject.Find(BRAIN_PARTS_NAME); crossfadeSlider = GameObject.Find("CrossfadeSlider"); muteButton = GameObject.Find("mute").GetComponent <MuteButtonAction>(); eventSystem = GameObject.Find("PreLoad/InputManager/EventSystem").GetComponent <EventSystem>(); dataRecorder = GameObject.Find("PreLoad").GetComponent <DataRecorder>(); fmriBrain = GameObject.Find(FMRI_BRAIN_NAME); //fmriBrain.SetActive(false); // mriScans = GameObject.Find(MRI_SCANS); controlsUI = GameObject.Find(Control_UI); gazeManager = GameObject.Find(HOLOGRAM_COLLECTION_NAME).GetComponent <HTGazeManager>(); mriScans = GameObject.Find(MRI_SCANS_NAME); mriCollection = GameObject.Find(MRI_COLLECTION_NAME); voiceRecognitionKeywords = new Dictionary <string, Action>(); foreach (var item in Names.GetStructureNames()) { voiceRecognitionKeywords.Add("Add " + item, () => { HandleAddBrainPart(item); }); voiceRecognitionKeywords.Add("Remove " + item, () => { HandleRemoveBrainPart(item); }); } //map voice commands to the corresponding button name buttonActionsToGameObjectName = new Dictionary <string, string> { { "Rotate", "rotate-stop" }, //{ "Rotate Walls", "rotate-walls-icon" }, { "Stop", "rotate-stop" }, { "Expand", "expand-collapse" }, { "Collapse", "expand-collapse" }, // { "Reset", "reset-icon" }, { "Scale Up", "scale-up" }, { "Scale Down", "scale-down" }, { "Isolate", "menu" }, { "Hide Isolate", "menu" }, { "Reposition", "reposition-icon" }, { "Add All", "menu" }, { "Remove All", "menu" }, { "Microglia", "menu" }, { "Channel 1", "menu" }, { "Channel 2", "menu" }, { "MRI", "mri-icon" }, { "MRI Outline", "show-colour-icon" }, { "Pin", "pin-unpin" }, { "Structures", "structures-icon" }, //New Voice Commands { "Play", "menu" }, { "Pause", "menu" }, { "Faster", "menu" }, { "Slower", "menu" }, { "Skip One", "menu" }, { "Skip Ten", "menu" }, { "Back One", "menu" }, { "Back Ten", "menu" }, { "Educational Room", "rooms" }, { "MRI Room", "rooms" }, { "fMRI Room", "rooms" }, { "Brain Cell Room", "rooms" }, { "DTI Room", "rooms" }, { "End Tutorial", "SkipButton" }, { "Next", "NextButton" }, { "Locate", "Locate" } }; voiceRecognitionKeywords.Add("Rotate", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Rotate"]), () => { var rs = brain.GetComponent <RotateStructures>(); return(rs != null && rs.isRotating == false); }, typeof(RotateButtonAction))); voiceRecognitionKeywords.Add("Stop", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Stop"]), () => { var rs = brain.GetComponent <RotateStructures>(); return(rs != null && rs.isRotating == true); }, typeof(RotateButtonAction))); voiceRecognitionKeywords.Add("Scale Up", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Scale Up"]))); voiceRecognitionKeywords.Add("Scale Down", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Scale Down"]))); voiceRecognitionKeywords.Add("Expand", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Expand"]), () => { var sa = brain.GetComponent <StateAccessor>(); return(sa != null && sa.AbleToTakeAnInteraction()); }, typeof(ExplodeButtonAction), "Expand")); voiceRecognitionKeywords.Add("Collapse", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Collapse"]), () => { var sa = brain.GetComponent <StateAccessor>(); return(sa != null && sa.AbleToTakeAnInteraction()); }, typeof(ExplodeButtonAction), "Collapse")); voiceRecognitionKeywords.Add("Isolate", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Isolate"]), () => { var rs = brain.GetComponent <RotateStructures>(); return(rs != null && !rs.isRotating); }, typeof(IsolateModeButtonAction))); voiceRecognitionKeywords.Add("Hide Isolate", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Hide Isolate"]), () => { var rs = brain.GetComponent <RotateStructures>(); return(rs != null && !rs.isRotating); }, typeof(IsolateExitButtonAction))); voiceRecognitionKeywords.Add("Reset", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Reset"]))); voiceRecognitionKeywords.Add("Reposition", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Reposition"]))); voiceRecognitionKeywords.Add("Add All", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Add All"]), typeof(IsolateButtonAction), buttonActionsToGameObjectName["Add All"])); voiceRecognitionKeywords.Add("Remove All", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Remove All"]), typeof(IsolateButtonAction), buttonActionsToGameObjectName["Remove All"])); // New Voice Commands voiceRecognitionKeywords.Add("Play", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Play"]), typeof(PlayButtonAction))); voiceRecognitionKeywords.Add("Pause", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Pause"]))); voiceRecognitionKeywords.Add("Faster", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Faster"]), typeof(SpeedUpButtonAction))); voiceRecognitionKeywords.Add("Slower", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Slower"]), typeof(SlowDownButtonAction))); voiceRecognitionKeywords.Add("Skip One", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Skip One"]), typeof(SkipOneButtonAction))); voiceRecognitionKeywords.Add("Back One", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Skip One"]), typeof(BackOneButtonAction))); voiceRecognitionKeywords.Add("Skip Ten", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Skip Ten"]), typeof(SkipTenButtonAction))); voiceRecognitionKeywords.Add("Back Ten", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Back Ten"]), typeof(BackTenButtonAction))); voiceRecognitionKeywords.Add("Educational Room", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Educational Room"]), typeof(EduRoomCommand))); voiceRecognitionKeywords.Add("FMRI Room", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["fMRI Room"]), typeof(fMRIRoomCommand))); voiceRecognitionKeywords.Add("Functional MRI Room", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["fMRI Room"]), typeof(fMRIRoomCommand))); voiceRecognitionKeywords.Add("MRI Room", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["MRI Room"]), typeof(MRIRoomCommand))); voiceRecognitionKeywords.Add("MRI Scan Room", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["MRI Room"]), typeof(MRIRoomCommand))); voiceRecognitionKeywords.Add("Brain Cell Room", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Brain Cell Room"]), typeof(CellRoomCommand))); voiceRecognitionKeywords.Add("Show Microglia", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Microglia"]), typeof(SwapCellButtonAction), "microglia")); voiceRecognitionKeywords.Add("Show Channel One", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Channel 1"]), typeof(SwapCellButtonAction), "channel1")); voiceRecognitionKeywords.Add("Show Channel Two", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Channel 2"]), typeof(SwapCellButtonAction), "channel2")); //UNCOMMENT THIS FOR GAZE MARKER //voiceRecognitionKeywords.Add("Place Marker", HandlePlaceMarker); //voiceRecognitionKeywords.Add("Clear Marker", HandleClearMarker); //voiceRecognitionKeywords.Add("Show MRI Scans", HandleMRI); //commented because mris now show in mri room only //voiceRecognitionKeywords.Add("Show Outline", HandleMRIOutlineOn); // mri ouline toggle functionaly disabled for now (MRIManager needs refactoring or splitting up) //voiceRecognitionKeywords.Add("Hide Outline", HandleMRIOutlineOff); //voiceRecognitionKeywords.Add("Toggle Outline", HandleMRIOutline); voiceRecognitionKeywords.Add("Pin Menu", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Pin"]), () => { var cu = controlsUI.GetComponent <ControlsUIManager>(); return(cu != null && !cu.GetMenuPinState()); }, typeof(PinButtonAction))); voiceRecognitionKeywords.Add("UnPin Menu", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Pin"]), () => { var cu = controlsUI.GetComponent <ControlsUIManager>(); return(cu != null && cu.GetMenuPinState()); }, typeof(PinButtonAction))); //voiceRecognitionKeywords.Add("Show Structures", HandleStructuresMode); //voiceRecognitionKeywords.Add("End Tutorial", HandleEndTutorial); //voiceRecognitionKeywords.Add("Next", HandleNextChapter); voiceRecognitionKeywords.Add("Locate", HandleCommand(GameObject.Find(buttonActionsToGameObjectName["Locate"]))); keywordRecognizer = new KeywordRecognizer(voiceRecognitionKeywords.Keys.ToArray()); keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized; keywordRecognizer.Start(); }