/// <summary> /// Triggers the FocusEntered and FocusExited events. /// </summary> /// <param name="previousObject">The object that was previously being gazed at.</param> /// <param name="newObject">The object that is currently being gazed at.</param> private void GazeManager_FocusedObjectChanged(GameObject previousObject, GameObject newObject) { if (newObject == null) { if (IsGazed) { IsGazed = false; FocusExited.RaiseEvent(); } } else { if (newObject.transform.IsChildOf(gameObject.transform)) { if (!IsGazed) { IsGazed = true; gameObject.GetComponent <SpriteRenderer>().sprite = HoverSprite; FocusEntered.RaiseEvent(); } } else if (IsGazed) { IsGazed = false; FocusExited.RaiseEvent(); } } }
/// <summary> /// Triggers the FocusEntered and FocusExited events. /// </summary> /// <param name="previousObject">The object that was previously being gazed at.</param> /// <param name="newObject">The object that is currently being gazed at.</param> private void GazeManager_FocusedObjectChanged(GameObject previousObject, GameObject newObject) { if (!IsChild(newObject)) { if (IsChild(previousObject)) { FocusExited.RaiseEvent(); } } else if (!IsChild(previousObject)) { FocusEntered.RaiseEvent(); } }