Example #1
0
    private void talk()
    {
        if (!__dialog_ongoing)
        {
            __dialog_ongoing = true;
            GameObject ui_go = Instantiate(dialogUI);
            __loaded_dialog_ui  = ui_go.GetComponent <UIDialog>();
            __curr_dialog_index = 0;
            __talk_bubble.setIsTalking(true);
            if (!!__animator)
            {
                __animator.SetBool(__animator_talk_parm, true);
            }
        }

        if (__loaded_dialog_ui == null)
        {
            return;
        }

        if (!__loaded_dialog_ui.message_is_displayed() &&
            __loaded_dialog_ui.has_a_message_to_display())
        {
            __loaded_dialog_ui.force_display();
        }
        else
        {
            if (__loaded_dialog_ui.overflows)
            {
                __loaded_dialog_ui.display(npc_name, __loaded_dialog_ui.overflowing_text);
            }
            else
            {
                if (__curr_dialog_index >= __dialog.Length)
                {
                    end_dialog();
                    return;
                }

                __loaded_dialog_ui.display(npc_name, __dialog[__curr_dialog_index]);
                playVoice();
                __curr_dialog_index++;
            }
        }
    }