using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; public class A9GDrop : MonoBehaviour, IDropHandler { private Text thisText; public int index = 9; public void Awake() { thisText = GetComponent(); } public void SetupThis(string txt, int id = 9) { thisText = GetComponent(); index = id; thisText.text = txt; } public void OnDrop(PointerEventData data) { A9GDrag received; if (data.pointerDrag.gameObject.GetComponent()) { received = data.pointerDrag.gameObject.GetComponent(); if (received.thisAnswer.isCorrect) { if (received.thisAnswer.indexToSet == index && !received.answered) { received.answered = true; thisText.text = received.thisAnswer.answer; A9GQuestionManager.instance.CorrectAnswer(); } else { A9GAudioSystem.instance.PlayWrong(); } } else { A9GAudioSystem.instance.PlayWrong(); } } } }