public void DisplayQuestion(QuestionDialogueContainer questionDialogue) { if (questionDialogue.questionButtons.Length > buttons.Length) { throw new System.ArgumentException("The number of questions exceed the number of buttons available."); } float yOffSet = 30 * (questionDialogue.questionButtons.Length - 1); for (int i = 0; i < questionDialogue.questionButtons.Length; i++) { if (questionDialogue.questionButtons[i].questionAsked == true) { buttons[i].GetComponent <Image>().color = Color.gray; } else { buttons[i].GetComponent <Image>().color = Color.white; } buttons[i].GetComponent <RectTransform>().anchoredPosition = new Vector2(0, yOffSet); buttons[i].GetComponentInChildren <Text>().text = questionDialogue.questionButtons[i].text; buttons[i].GetComponent <Button>().onClick.RemoveAllListeners(); buttons[i].gameObject.SetActive(true); yOffSet -= 60; } }
public void PickedQuestion(int questionChoice) { player.GetComponent <PlayerController>().blockMovement = false; foreach (Button b in buttons) { b.gameObject.SetActive(false); } if (currentDialogueContainer is QuestionDialogueContainer) { QuestionDialogueContainer questionDialogueContainer = (QuestionDialogueContainer)currentDialogueContainer; questionDialogueContainer.questionButtons[questionChoice].questionAsked = true; if (questionDialogueContainer.questionButtons[questionChoice].nextDialogueContainer != null) { StartDialogue(questionDialogueContainer.questionButtons[questionChoice].nextDialogueContainer); } } else { SpecialQuestionDialogueContainer specDialogueContainer = (SpecialQuestionDialogueContainer)currentDialogueContainer; specDialogueContainer.questionButtons[questionChoice].questionAsked = true; if (specDialogueContainer.questionButtons[questionChoice].nextDialogueContainer != null) { StartDialogue(specDialogueContainer.questionButtons[questionChoice].nextDialogueContainer); } } }