36 lines
966 B
C#
36 lines
966 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.EventSystems;
|
|
|
|
public class DropZone : MonoBehaviour, IDropHandler, IPointerEnterHandler, IPointerExitHandler
|
|
{
|
|
public PuzzleManager puzzleManager;
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
Debug.Log("🎯 Pointer masuk DropZone");
|
|
}
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
{
|
|
Debug.Log("🚪 Pointer keluar DropZone");
|
|
}
|
|
public void OnDrop(PointerEventData eventData)
|
|
{
|
|
Debug.Log("✅ OnDrop terpanggil!");
|
|
|
|
if (eventData.pointerDrag == null)
|
|
{
|
|
Debug.LogWarning("⚠️ pointerDrag null!");
|
|
return;
|
|
}
|
|
|
|
DragItem dragItem = eventData.pointerDrag.GetComponent<DragItem>();
|
|
if (dragItem == null)
|
|
{
|
|
Debug.LogWarning("⚠️ DragItem tidak ditemukan!");
|
|
return;
|
|
}
|
|
|
|
puzzleManager.CekJawaban(dragItem);
|
|
}
|
|
} |