using UnityEngine;
using System.Collections;

public class DragAndDrop : MonoBehaviour {

	public string ingredientName;

    private Vector3 startPosition;

	// Use this for initialization
	void Start () {
        startPosition = transform.position;
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	void OnMouseDrag() {
		Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
		transform.position = new Vector3(pos.x, pos.y, 0f);
	}

	void OnMouseUp() {
        if (!Controller.Instance.onPot) {
            if (transform.position != startPosition)
            {
                transform.position = startPosition;
            }
        }
        else
        {
            Controller.Instance.DropItem(gameObject);
        }
	}
}
