private void OnDestroy() { parentsGazeObserver = GetComponentInParent <GazeObserver>(); if (parentsGazeObserver != null) { parentsGazeObserver.FocusEntered -= ShowIfFocusedWithDelay; parentsGazeObserver.FocusExited -= HideIfNotFocusedWithDelay; } }
/// <summary> /// Performs initialization related to the gaze observer. /// </summary> private void InitGazeObserver() { gazeObserver = GetComponent <GazeObserver>(); if (gazeObserver != null) { gazeObserver.FocusEntered += EnablePassiveState; } else { Debug.LogError("Souvenir.cs expects a GazeObserver component."); } }
/// <summary> /// If the parent is being gazed at and the keyword is in the keyword dictionnary, invokes the corresponding callback. /// </summary> private void OnSpeechKeywordRecognized(SpeechKeywordRecognizedEventData eventData) { GazeObserver gazeObserver = transform.GetComponentInParent <GazeObserver>(); if (gazeObserver != null && gazeObserver.IsGazed) { Debug.Log(String.Format("Keywords recognized : {0}", eventData.RecognizedText)); Action action; if (keywords.TryGetValue(eventData.RecognizedText.ToLower(), out action)) { action.Invoke(); } } }
protected void Start() { parentsGazeObserver = GetComponentInParent <GazeObserver>(); if (parentsGazeObserver != null) { parentsGazeObserver.FocusEntered += ShowIfFocusedWithDelay; parentsGazeObserver.FocusExited += HideIfNotFocusedWithDelay; } else { Debug.LogError("The Tooltip.cs script expects its parent to have a GazeObserver.cs."); } ChangeVisibility(false); }
private void OnDestroy() { GazeObserver gazeObserver = transform.GetComponentInParent <GazeObserver>(); if (gazeObserver != null) { gazeObserver.FocusEntered -= ShowHoloBar_OnParentFocusEnter; gazeObserver.FocusExited -= HideHoloBar_OnParentFocusExit; } var voiceCommandManager = FindObjectOfType <VoiceCommandsManager>(); if (voiceCommandManager != null) { voiceCommandManager.SpeechKeywordRecognized -= OnSpeechKeywordRecognized; } }
protected virtual void Start() { keywords = new Dictionary <string, Action>(); // Hides the holobar if the parent object is not on focus GazeObserver gazeObserver = transform.GetComponentInParent <GazeObserver>(); if (gazeObserver != null) { gazeObserver.FocusEntered += ShowHoloBar_OnParentFocusEnter; gazeObserver.FocusExited += HideHoloBar_OnParentFocusExit; } var voiceCommandManager = FindObjectOfType <VoiceCommandsManager>(); if (voiceCommandManager != null) { voiceCommandManager.SpeechKeywordRecognized += OnSpeechKeywordRecognized; } RefreshBar(); }
private void Start() { gazeObserver = GetComponent <GazeObserver>(); voiceCommands = new Dictionary <string, Action>(); eventAudioManager = EventAudioManager.Instance; planeMaterial = Resources.Load <Material>(Constants.ImagePlaneMaterial); if (planeMaterial == null) { Debug.LogError("Could not load the image plane material."); } presenterManager = FindObjectOfType <ActiveSouvenirManager>(); if (presenterManager == null) { Debug.LogError("This script expects a presenter manager component in the scene."); } if (photoArrangementPrefab == null) { photoArrangementPrefab = Resources.Load <GameObject>(Constants.PhotoArrangementPrefab); if (photoArrangementPrefab == null) { Debug.LogError("Could not load photo arrangement prefab."); } } if (photoArrangementPrefab != null) { photoArrangement = Instantiate(photoArrangementPrefab, transform); if (photoArrangement != null) { // We want the photo arrangement to be centered with the souvenir. photoArrangement.transform.localPosition = Vector3.zero; photoArrangement.transform.localEulerAngles = Vector3.zero; photoCoordinates = TagsHelper.FindChildrenWithTag(photoArrangement, TagsHelper.ArrangementPictureCoords); photoNavigator = TagsHelper.FindChildWithTag(photoArrangement, TagsHelper.PhotoNavigator); loadingIcon = TagsHelper.FindChildWithTag(photoArrangement, Constants.LoadingIcon); numberOfPresenters = Math.Min(Constants.MaxNumberOfPresenters, photoCoordinates.Count); } else { Debug.LogError("Could not instantiate the photo arrangement prefab."); } } CreatePresenters(); BindPhotoNavigator(); if (Souvenir != null) { carousel.transform.parent = Souvenir.transform; Souvenir.ActiveStateEnabled += EnableGridState; Souvenir.ActiveStateDisabled += EnableCarouselState; Souvenir.PassiveStateEnabled += EnableCarouselState; Souvenir.PassiveStateDisabled += EnableSleepingState; } isInContentTransition = true; }
private void Start() { gazeObserver = GetComponent <GazeObserver>(); }
public GazeViewModel(GazeObserver observer) { _observer = observer; Setup(); }
public GazeDisplayControlService(Dispatcher dispatcher, GazeObserver observer) { _dispatcher = dispatcher; _observer = observer; }