using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public class FixedDialogue
{
    public string speaker;

    [TextArea(0, 3)]
    public string[] lines;
    public int idx;

    public DialogueOption[] answers;

    public string[] consequences;

    public void Start()
    {
        idx = 0;
        DialogueManager.instance.StartDialogue(this, speaker, lines[idx]);
    }

    public void Advance()
    {
        idx++;
        if (idx < lines.Length)
            /*
            dialogueDisplayer?.ShowLine(lines[idx++]);
        else
        {
            dialogueDisplayer?.ShowLine("");
            optionsDisplayer.ClearOptions();
            if (answers == null)
            {
                Debug.LogWarning("Answerless dialogue found");
            }
            else foreach (DialogueOption answer in answers)
                optionsDisplayer.AddOption(answer);
        }
            */
        {
            DialogueManager.instance.AdvanceDialogue(this, speaker, lines[idx]);
        }
        else
            DialogueManager.instance.EndDialogue(this, speaker, lines[lines.Length - 1]);
    }
}