using UnityEngine;
using System.Collections;

public class PurchaseObject : MonoBehaviour {
	
	public GameObject product;
	public int cost;
	
	private States states;
	
	// Use this for initialization
	void Start ()
	{
		states = GameObject.Find ("Player").GetComponent<States>();
	}
	
	void Use ()
	{
		if (states.playerMoney >= cost)
		{
			states.playerMoney -= cost;
			product.SetActive(true);
			gameObject.SetActive(false);
		}
	}
}
