using UnityEngine;
using System.Collections;

public class TableMoney : MonoBehaviour {
	
	private States states;
	
	public AudioClip pickup;
	
	// Use this for initialization
	void Start () {
		states = GameObject.Find("Player").GetComponent<States>();
	}
	
	// Update is called once per frame
	void Update () {
		if (states.tableMoney > 0)
		{
			renderer.enabled = true;
			transform.tag = "Interactable";
		}	
		else
		{
			renderer.enabled = false;
			transform.tag = "Untagged";
		}	
	}
	
	void Use ()
	{
		AudioSource.PlayClipAtPoint (pickup, transform.position);
		states.playerMoney += states.tableMoney;
		states.tableMoney = 0;
	}
}
