using UnityEngine;
using System.Collections;

public class WorkbenchManager : MonoBehaviour {
	public Vector2 StartPosition;
	MyManager manager;
	bool _canCraft = false;
	GameObject _craftButton;
	
	void Awake()
	{
		manager = GameObject.Find("MyManager").GetComponent<MyManager>();
		StartPosition = transform.position;
		_craftButton = GameObject.Find("craftbutton");
		_craftButton.renderer.enabled = false;
	}

	void Update()
	{
		if((manager.player.inventory.GetItemCount("iconBottom") > 0 && manager.player.inventory.GetItemCount("iconCharm") > 0 && manager.player.inventory.GetItemCount("iconDown") > 0 && manager.player.inventory.GetItemCount("iconElectron") > 0 && manager.player.inventory.GetItemCount("iconElectronNeutrino") > 0 && manager.player.inventory.GetItemCount("iconGluon") > 0 && manager.player.inventory.GetItemCount("iconHiggsBoson") > 0 && manager.player.inventory.GetItemCount("iconMuon") > 0 && manager.player.inventory.GetItemCount("iconPhoton") > 0 && manager.player.inventory.GetItemCount("iconStrange") > 0 && manager.player.inventory.GetItemCount("iconTau") > 0 && manager.player.inventory.GetItemCount("iconTauNeutrino") > 0 && manager.player.inventory.GetItemCount("iconTop") > 0 && manager.player.inventory.GetItemCount("iconUp") > 0 && manager.player.inventory.GetItemCount("iconWBoson") > 0 && manager.player.inventory.GetItemCount("iconZBoson") > 0))
		{
			_canCraft = true;
		}

		if(_canCraft)
			_craftButton.renderer.enabled = true;
	}

	public void Craft()
	{
		if(_canCraft)
		{
			Application.LoadLevel("Explosion");
		}
	}
}
