using UnityEngine;
using System.Collections;

public class Powerup
{
		public string name, desc;
		public Texture2D icon;
		public int cost;
		public bool bought;

		public Powerup (string name, string desc, int cost, Texture2D icon)
		{
				this.name = name;
				this.desc = desc;
				this.cost = cost;
				this.icon = icon;

				bought = PlayerPrefs.GetInt (name, 0) == 1;
		}

		public void buy ()
		{
				if (PlayerPrefs.GetInt ("gold", 0) >= this.cost) {
						PlayerPrefs.SetInt ("gold", PlayerPrefs.GetInt ("gold", 0) - this.cost);
						PlayerPrefs.SetInt (this.name, 1);
						this.bought = true;
				}
		}
}
