using UnityEngine;
using UnityEngine.EventSystems;
using System.Collections;

public class Tooltip : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler {

	[Multiline]
	public string text;

	public int cost = 0;

	public void OnPointerEnter (PointerEventData eventData) {
		if(Game.current.mouseMode == Game.MouseMode.POINTER) {
			TooltipPanel.Show(this);
		}
	}

	public void OnPointerExit (PointerEventData eventData) {
		TooltipPanel.Hide(this);
	}

	public void OnMouseEnter() {
		if(Game.current.mouseMode == Game.MouseMode.POINTER) {
			TooltipPanel.Show(this);

			if(GetComponent<Turret>() != null) {
				RangeCircle.LockTo(transform, GetComponent<Turret>().CurrentRange(), false);
			}
			else if(GetComponent<Booster>() != null) {
				RangeCircle.LockTo(transform, GetComponent<Booster>().CurrentRadius(), true);
			}

		}
	}

	public void OnMouseExit() {
		TooltipPanel.Hide(this);
		if(Game.current.mouseMode == Game.MouseMode.POINTER) {
			RangeCircle.TurnOff();
		}
	}

}
