using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class LaunchTip : MonoBehaviour
{
	public AnimationCurve alpha = new AnimationCurve(new Keyframe(0, 1), new Keyframe(1, 0));
	public float time = 0;

	public void Show()
	{
		gameObject.SetActive(true);
		time = 0;
		GetComponent<CanvasGroup>().alpha = alpha.Evaluate(time);
	}

	public void Hide()
	{
		gameObject.SetActive(false);
	}

	void Update()
	{
		time += Time.smoothDeltaTime;
		GetComponent<CanvasGroup>().alpha = alpha.Evaluate(time);
		if (GetComponent<CanvasGroup>().alpha < 0.01f)
		{
			Hide();
		}
	}
}
