28 lines
685 B
C#
28 lines
685 B
C#
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();
|
|
}
|
|
}
|
|
}
|
|
} |