//---------------------------------------------------------------------
        // Implementing IGazeFocusInternal
        //---------------------------------------------------------------------

        /// <summary>
        /// Registers the supplied <see cref="IGazeFocusable"/> component so that
        /// the <see cref="GameObject"/> it belongs to can be focused using eye-gaze.
        /// </summary>
        /// <param name="gazeFocusableComponent"></param>
        public void RegisterFocusableComponent(IGazeFocusable gazeFocusableComponent)
        {
            if (FocusableObjects.Count == 0)
            {
                Initialize();
            }

            var instanceId = gazeFocusableComponent.gameObject.GetInstanceID();

            if (!FocusableObjects.ContainsKey(instanceId))
            {
                FocusableObjects.Add(instanceId, gazeFocusableComponent);
            }
        }
        /// <summary>
        /// Unregisters the supplied <see cref="IGazeFocusable"/> component so
        /// that the <see cref="GameObject"/> it belongs to no longer can be
        /// focused using eye-gaze.
        /// </summary>
        /// <param name="gazeFocusableComponent"></param>
        public void UnregisterFocusableComponent(IGazeFocusable gazeFocusableComponent)
        {
            var instanceId = gazeFocusableComponent.gameObject.GetInstanceID();

            if (_focusedObject.IsValid &&
                _focusedObject.GameObject.GetInstanceID() == instanceId)
            {
                FocusedObject = FocusedObject.Invalid;
            }

            FocusableObjects.Remove(instanceId);

            if (Scorer != null)
            {
                Scorer.RemoveObject(gazeFocusableComponent.gameObject);
            }
            if (_multiScorer != null)
            {
                _multiScorer.RemoveObject(gazeFocusableComponent.gameObject);
            }
        }
Exemple #3
0
        /// <summary>
        /// Unregisters the supplied <see cref="IGazeFocusable"/> component so
        /// that the <see cref="GameObject"/> it belongs to no longer can be
        /// focused using eye-gaze.
        /// </summary>
        /// <param name="gazeFocusableComponent"></param>
        public void UnregisterFocusableComponent(IGazeFocusable gazeFocusableComponent)
        {
            var instanceId = gazeFocusableComponent.gameObject.GetInstanceID();

            if (_focusedObject.IsValid &&
                _focusedObject.GameObject.GetInstanceID() == instanceId)
            {
                // TODO: set to other object with high focus confidence instead?
                FocusedObject = FocusedObject.Invalid;
            }

            FocusableObjects.Remove(instanceId);

            if (Scorer != null)
            {
                Scorer.RemoveObject(gazeFocusableComponent.gameObject);
            }
            if (_multiScorer != null)
            {
                _multiScorer.RemoveObject(gazeFocusableComponent.gameObject);
            }
        }
 public void UnregisterFocusableComponent(
     IGazeFocusable gazeFocusableComponent)
 {
     /** no implementation **/
 }