private void MoveOver(RealmsInteractiveItem item, RaycastHit hit) { if (item != null) { item.MoveOver(hit); } }
private void Out(RealmsInteractiveItem item) { if (item != null) { item.Out(); } }
protected void SetInteractivityStatus(bool isInteractive) { if (_interactivity == null) { _interactivity = gameObject.GetComponent <RealmsInteractiveItem> (); } if (_isInteractive == isInteractive) { return; } _isInteractive = isInteractive; if (isInteractive) { _interactivity.OnOver += OnInteractionOver; _interactivity.OnOut += OnInteractionOut; _interactivity.OnClick += OnInteractionClick; } else { _interactivity.OnOver -= OnInteractionOver; _interactivity.OnOut -= OnInteractionOut; _interactivity.OnClick -= OnInteractionClick; } }
private void Click(RealmsInteractiveItem item) { if (item != null) { item.Click(); } }
void Awake() { foreach (GameObject button in _buttons) { RealmsInteractiveItem ii = button.GetComponent <RealmsInteractiveItem> (); ii.OnOver += OnOver; ii.OnOut += OnOut; } foreach (var toolbar in GameObject.FindObjectsOfType <RealmToolbarWithMovingButtons>()) { RealmsInteractiveItem ii = toolbar.GetComponent <RealmsInteractiveItem> (); ii.OnOver += OnOver; ii.OnOut += OnOut; } _interaction = gameObject.GetComponent <RealmsInteractiveItem> (); if (_interaction != null) { _interaction.OnMoveOver += OnMoveOver; _interaction.OnOver += OnToolbarOver; _interaction.OnOut += OnToolbarOut; } Hide(false); }
void Awake() { _interaction = gameObject.GetComponent <RealmsInteractiveItem> (); _playback = gameObject.GetComponentInChildren <RealmYouTubePlayback> (); _youtubeManager = gameObject.GetComponent <YoutubeAPIManager> (); _playButtonUI = gameObject.GetComponentInChildren <RealmPlayPauseButtonUI> (); _playerAudio = _playback.GetComponentInChildren <AudioSource> (); _playerAudio.playOnAwake = false; }
void Awake() { RealmsInteractiveItem interaction = gameObject.GetComponent <RealmsInteractiveItem> (); if (interaction != null) { interaction.OnOver += OnOver; interaction.OnOut += OnOut; } }
void Awake() { RealmsInteractiveItem ii = gameObject.GetComponent <RealmsInteractiveItem> (); if (ii != null) { ii.OnOver += Ii_OnOver; ii.OnMoveOver += Ii_OnMoveOver; } }
void Awake() { RealmsInteractiveItem interaction = gameObject.GetComponent <RealmsInteractiveItem> (); if (interaction != null) { interaction.OnOver += OnOver; interaction.OnOut += OnOut; } foreach (var relative in _relatives) { relative.OnOver += OnOver; relative.OnOut += OnOut; } }
void Awake() { _display = gameObject.GetComponent <RawImage> (); Debug.Assert(_display != null, "Display image is missing"); RealmsInteractiveItem ii = gameObject.GetComponent <RealmsInteractiveItem> (); if (ii != null) { ii.OnClick += () => { if (OnClick != null) { OnClick(_data); } }; } }
virtual protected void Init() { _buttonUI = GetComponent <ButtonWithClickMeterUI>(); RealmsInteractiveItem gazeInteraction = gameObject.GetComponent <RealmsInteractiveItem> (); if (gazeInteraction != null) { gazeInteraction.OnOut += OnOut; gazeInteraction.OnMoveOver += OnMoveOver; } _clickMeter = gameObject.GetComponent <GazeClickMeter> (); Debug.Assert(_clickMeter != null, this + ": Click meter is missing"); _clickMeter.OnFull += OnMeterFull; _clickMeter.OnProgress += OnMeterProgress; }
void OnMoveOver(RaycastHit hit) { Vector3 localColliderSize; Vector3 localHitPoint; RealmsInteractiveItem.GetLocalHitData(hit, out localColliderSize, out localHitPoint); switch (_orientation) { case Orientation.VERTICAL: SetVerticalPosition(localHitPoint.y + localColliderSize.y / 2); break; case Orientation.HORIZONTAL: default: SetHorizontalPosition(localHitPoint.x + localColliderSize.x / 2); break; } }
private void InitInteractions() { AfterDataLoadedInit = null; _gallery.OnImageReady += OnGalleryImageLoaded; RealmsInteractiveItem ii = gameObject.GetComponent <RealmsInteractiveItem> (); if (ii != null) { ii.OnOver += OnOver; ii.OnOut += OnOut; ii.OnMoveOver += OnMoveOver; } foreach (var button in _buttons) { button.OnOver += () => { _autoplay.Pause(); }; button.OnOut += () => { _autoplay.Resume(); }; } _autoplay.OnComplete += OnAutoplayComplete; }
private void CheckHit() { _lineRender.SetPosition(0, transform.position); Ray ray = new Ray(transform.position, transform.forward); RaycastHit hit; bool isSomethingHit = Physics.Raycast(ray, out hit, 100); if (isSomethingHit) { _lineRender.SetPosition(1, hit.point); } else { _lineRender.SetPosition(1, transform.forward * 100); } if (isSomethingHit) { RealmsInteractiveItem ii = hit.collider.GetComponent <RealmsInteractiveItem> (); if (ii == null || ii != _currentInteraction) { Out(_currentInteraction); } _currentInteraction = ii; MoveOver(_currentInteraction, hit); Over(_currentInteraction); } else { Out(_currentInteraction); _currentInteraction = null; } }
void OnMoveOver(RaycastHit hit) { _autoplay.Pause(); Vector3 localColliderSize; Vector3 localHitPoint; RealmsInteractiveItem.GetLocalHitData(hit, out localColliderSize, out localHitPoint); Canvas.ForceUpdateCanvases(); float y = (localHitPoint.y + localColliderSize.y / 2) / localColliderSize.y; if (y < 0.2f) { AnimateText(FULL_TEXT_HEIGHT); } else if (y > 0.9f) { AnimateText(SHORT_TEXT_HEIGHT); } Canvas.ForceUpdateCanvases(); }
private void CheckHit() { Ray ray = new Ray(_headAnchor.transform.position, _headAnchor.transform.forward); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100f)) { _cursor.transform.position = hit.point; _cursor.transform.rotation = Quaternion.LookRotation(hit.normal); RealmsInteractiveItem ii = hit.collider.GetComponent <RealmsInteractiveItem> (); if (ii == null) { return; } if (ii != _lastInteraction) { _focusTimer = 0f; _isFocusConsumed = false; _isFocusing = false; Out(_lastInteraction); } _lastInteraction = ii; MoveOver(_lastInteraction, hit); Over(_lastInteraction); if (_lastInteraction.doShowCursor == false) { _cursor.UpdateMode(RealmsGazeCursor.Mode.INVISIBLE); return; } if (_lastInteraction.isClickable == false) { _cursor.UpdateMode(RealmsGazeCursor.Mode.NORMAL); return; } if (_isFocusConsumed == false) { if (_isFocusing == false) { _isFocusing = true; _focusTimer = CLICK_TIMER; } else { _cursor.UpdateMode(RealmsGazeCursor.Mode.TIMER); _focusTimer -= Time.deltaTime; if (_focusTimer <= 0f) { _isFocusConsumed = true; _focusTimer = 0f; Click(_lastInteraction); _cursor.UpdateMode(RealmsGazeCursor.Mode.NORMAL); } } _cursor.UpdateTimer(_focusTimer); } } else { _cursor.UpdateMode(RealmsGazeCursor.Mode.NORMAL); _cursor.transform.position = _headAnchor.transform.position + _headAnchor.transform.forward * 10f; _cursor.transform.rotation = Quaternion.LookRotation(_cursor.transform.position - _headAnchor.transform.position); _isFocusing = false; _isFocusConsumed = false; _cursor.UpdateTimer(1); Out(_lastInteraction); _lastInteraction = null; } }