/// <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);
            }
        }
Esempio n. 2
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);
            }
        }