48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class RWA_QuestionObejct : MonoBehaviour
|
|
{
|
|
private Text questionTxt;
|
|
private Image questionImage;
|
|
private RWA_QuestionClass thisQuestion;
|
|
private List<RWA_AnswerObject> answerObjects = new List<RWA_AnswerObject>();
|
|
|
|
private void Awake()
|
|
{
|
|
questionImage = transform.Find("QuestionImage").GetComponent<Image>();
|
|
questionTxt = transform.Find("QuestionText").GetComponent<Text>();
|
|
List<RWA_AnswerObject> temp = new List<RWA_AnswerObject>();
|
|
answerObjects.AddRange(GameObject.Find("AnswerOrganizer").GetComponentsInChildren<RWA_AnswerObject>());
|
|
}
|
|
|
|
public void SetupQuestion(RWA_QuestionClass q)
|
|
{
|
|
if (q.qImage != null)
|
|
{
|
|
questionImage.sprite = q.qImage;
|
|
}
|
|
thisQuestion = q;
|
|
questionTxt.text = q.question;
|
|
SetupAnswers();
|
|
}
|
|
|
|
public void SetupAnswers()
|
|
{
|
|
for(int i = 0; i < answerObjects.Count;i++)
|
|
{
|
|
answerObjects[i].Setup(thisQuestion.answers[i]);
|
|
}
|
|
}
|
|
|
|
public void DeactivateAnswers()
|
|
{
|
|
for (int i = 0; i < answerObjects.Count; i++)
|
|
{
|
|
answerObjects[i].Shutup();
|
|
}
|
|
}
|
|
}
|