using UnityEngine;
using System.Collections;

public class ItemPicking : MonoBehaviour {
	public GameObject door;
	private static bool isDisabled;
	private PlayerController player;
	// Use this for initialization
	void Start () {
		player = GameObject.Find("Player").GetComponent<PlayerController>();
		isDisabled = false;
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	void OnMouseDown(){
		if(!isDisabled){
			//Add item to inventory
			player.SetItemType(gameObject.name);
			//disable clicking other items
			isDisabled = true;
			//destroy the model
			Destroy (door.gameObject);
			Destroy(gameObject);
		}
	}
}
