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

public class UpgradeText : MonoBehaviour {

    public int power;
    public string preface, zeroText;
    
	void Update ()
    {
        Cursor.visible = true;
        if (UpgradeController.instance.getLevel(power) == 0)
            transform.GetComponentInChildren<Text>().text = zeroText;
        else
            transform.GetComponentInChildren<Text>().text = preface;

        transform.GetComponentInChildren<Text>().text += "\n\nLv" + UpgradeController.instance.getLevel(power).ToString() + " --> Lv" +
            (UpgradeController.instance.getLevel(power) + 1).ToString();

        if (UpgradeController.instance.getCost(power) == 1)
            transform.GetComponentInChildren<Text>().text += "\n" + UpgradeController.instance.getCost(power).ToString() + " Drug";
        else
            transform.GetComponentInChildren<Text>().text += "\n" + UpgradeController.instance.getCost(power).ToString() + " Drugs";

        GetComponent<Button>().interactable = GameController.instance.points >= UpgradeController.instance.getCost(power);
    }
}
