ZoeAppClass/Assets/Jogos/Aula11/Game6/Scripts/A11G6Droper.cs

33 lines
832 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class A11G6Droper : MonoBehaviour, IDropHandler
{
public A11G6QuestionClass thisQuestion;
private Image thisImage;
public void SetupThis(A11G6QuestionClass rQ)
{
thisImage = GetComponent<Image>();
thisQuestion = rQ;
thisImage.sprite = thisQuestion.questionImage;
}
public void OnDrop(PointerEventData data)
{
A11G6Dragger temp = data.pointerDrag.GetComponent<A11G6Dragger>();
if (temp.thisAnswer.isCorrect)
{
temp.answered = true;
A11G6QuestionManager.instance.CorrectAnswer();
}
else
{
A11G6QuestionManager.instance.WrongAnswer();
}
}
}