using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;

public class KeySlot : MonoBehaviour, IDropHandler
{
    public string correctKeyID;

    public void OnDrop(PointerEventData eventData)
    {
        DraggableKey key = eventData.pointerDrag.GetComponent<DraggableKey>();

        if (key != null)
        {
            if (key.keyID == correctKeyID)
            {
                key.transform.position = transform.position;
                key.enabled = false;

                KeyminigameManager.Instance.CheckWin();
            }
            else
            {
                KeyminigameManager.Instance.Fail();
            }
        }
    }
}