// Copyright (C) 2015-2021 gamevanilla - All rights reserved.
// This code can only be used under the standard Unity Asset Store End User License Agreement.
// A Copy of the Asset Store EULA is available at http://unity3d.com/company/legal/as_terms.
using UnityEngine;
using UnityEngine.EventSystems;
namespace UltimateClean
{
///
/// Basic tooltip component used in the kit.
///
public class Tooltip : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
public GameObject tooltip;
public float fadeTime = 0.1f;
public virtual void OnPointerEnter(PointerEventData eventData)
{
if (eventData.button != PointerEventData.InputButton.Left)
{
return;
}
if (tooltip != null)
{
StartCoroutine(Utils.FadeIn(tooltip.GetComponent(), 1.0f, fadeTime));
}
}
public virtual void OnPointerExit(PointerEventData eventData)
{
if (eventData.button != PointerEventData.InputButton.Left)
{
return;
}
if (tooltip != null)
{
StartCoroutine(Utils.FadeOut(tooltip.GetComponent(), 0.0f, fadeTime));
}
}
}
}