Exemplo n.º 1
0
    void SetNewLine()
    {
        speachDataActive = speachData[id];
        int length = speachDataActive.multiplechoice.Length;

        talkState.ChangeMood(speachDataActive.mood);

        if (length == 0)
        {
            simpleField.text = speachDataActive.text;
            SimpleText.SetActive(true);
            MultipleChoice.SetActive(false);
        }
        else
        {
            MultiplceChoiceButtonUI[] all = mcContainer.GetComponentsInChildren <MultiplceChoiceButtonUI>();
            int i = all.Length;
            while (i > 0)
            {
                Destroy(all[i - 1].gameObject);
                i--;
            }

            foreach (Talk.MultiplechoiceData mcData in speachDataActive.multiplechoice)
            {
                MultiplceChoiceButtonUI button = Instantiate(multipleChoiceButton, mcContainer);
                button.Init(this, mcData);
            }
            multiplechoiceField.text = speachDataActive.text;
            SimpleText.SetActive(false);
            MultipleChoice.SetActive(true);
        }
    }