//============================================================================== // MonoBehaviours //============================================================================== //============================================================================== public void Start() { m_GazeBase = GetComponent <GazeBase>(); m_Renderer = GetComponent <Renderer>(); m_GazeBase.onGazeBeginCallBack += OnGazeStart; m_GazeBase.onGazeEndCallBack += OnGazeEnd; SetColor(m_DefaultColor); }
//============================================================================== // Private //============================================================================== //============================================================================== // TODO: This is way to long - needs to be abstracted a bit //============================================================================== private void EyeRaycast() { // start position for raycast Vector3 startPosition = transform.position; // direction for raycast Vector3 direction = transform.forward; // the ray Ray ray = new Ray(startPosition, direction); // debug ray in editor mode if (m_showDebugRay) { Debug.DrawRay(ray.origin, ray.direction * m_rayLenght, Color.red); } // raycasthit information RaycastHit hit; if (Physics.Raycast(startPosition, direction * m_rayLenght, out hit, m_rayLenght)) { m_reticle.SetPosition(hit.point); m_reticle.SetScale(hit.distance); if (hit.transform.gameObject != m_CurrentlyGazedOn) { //============================================================================== // Gaze Objects //============================================================================== if (m_GazeObjects.ContainsKey(hit.transform)) { m_GazeObjects[hit.transform].StartGaze(); m_CurrentlyGazedObject = m_GazeObjects[hit.transform]; } else { m_reticle.StopLoad(); if (m_CurrentlyGazedObject != null) { m_CurrentlyGazedObject.StopGaze(); m_CurrentlyGazedObject = null; } } //============================================================================== } m_CurrentlyGazedOn = hit.transform.gameObject; } }
//============================================================================== // MonoBehaviours //============================================================================== //============================================================================== public void Start() { m_GazeBase = GetComponent <GazeBase>(); m_GazeBase.onGazeBeginCallBack += OnGazeStart; m_GazeBase.onGazeEndCallBack += OnGazeEnd; m_ScreenFade = FindObjectOfType <ScreenFade>(); m_isMoving = false; m_isLookedAt = false; m_moveDirection = Vector3.zero; m_Camera = FindObjectOfType <OVRManager>().GetComponent <Transform>(); if (m_text != null) { m_text.GetComponent <Renderer>().enabled = false; } }
// Use this for initialization void Start() { m_GazeBase = GetComponent <GazeBase>(); m_GazeBase.onGazeBeginCallBack += OnGazeStart; m_GazeBase.onGazeEndCallBack += OnGazeEnd; }
//============================================================================== // Public //============================================================================== public void RegisterGazeObject(Transform key, GazeBase value) { m_GazeObjects.Add(key, value); }