private void DisplayOptions(ParseDialogue.DialogueNode options)
 {
     RequestButtons(options.choices);
     for (int i = 0; i < _buttons.Count; i++)
     {
         Text txt = _buttons[i].GetComponentInChildren <Text>();
         txt.text = options.choice(i);
     }
     _choosing_option = true;
 }
    private void Update()
    {
        if (!_active)
        {
            return;
        }

        if (_current != null)
        {
            if (_prompt_number < _current.prompts)
            {
                if (_old_active && Input.GetKeyDown(KeyCode.Return))
                {
                    _prompt_number++;
                    if (_current.Submit(CommandInput.text))
                    {
                        StopCoroutine(_coroutine);
                        ShowDialogue(_current);
                    }
                    else
                    {
                        ShowDialogue(_database.next());
                    }
                }
            }
            else if (_old_active && Input.GetKeyDown(KeyCode.Space))
            {
                if (_writing)
                {
                    _index       = _current.text.Length + 1;
                    Display.text = _current.text;
                    StopCoroutine(_coroutine);
                    StartCoroutine(_coroutine = NextCharacter());
                }
                else if (!_choosing_option)
                {
                    ParseDialogue.DialogueNode n = _database.next();
                    ShowDialogue(n);
                }
            }
        }

        if (_choosing_option && _selection_made != -1)
        {
            _choosing_option = false;
            HideButtons();
            ShowDialogue(_database.selectionMade(_selection_made));
        }

        _old_active = _active;
    }
    private void ShowDialogue(ParseDialogue.DialogueNode start)
    {
        _current = start;

        if (start == null)
        {
            _logic.FinishTrigger();
            PropagateInterface(false);
            return;
        }
        if (!_active)
        {
            PropagateInterface(true);
            HideButtons();
        }
        if (start != _current)
        {
            CommandInput.text = "";
            _prompt_number    = 0;
        }

        bool input   = _prompt_number < start.prompts;
        bool speaker = !input && (start.speaker != null && start.speaker.Length != 0);

        SetSpeakerBox(speaker);
        SetInputBox(input);
        if (input)
        {
            UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(CommandInput.gameObject, null);
        }

        _index          = 0;
        _writing        = true;
        _selection_made = -1;

        Speaker.text = start.speaker;
        Display.text = "";
        StartCoroutine(_coroutine = NextCharacter());
    }