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

public class DialogueOptionsDisplayer : MonoBehaviour
{
    public Button[] optionButtons;

    public void ClearOptions()
    {
        foreach (Button btn in optionButtons)
            btn.gameObject.SetActive(false);
    }

    public void AddOption(DialogueOption option) 
    {
        foreach (Button btn in optionButtons)
        {
            if (!btn.IsActive())
            {
                btn.gameObject.SetActive(true);
                Text text = btn.GetComponentInChildren<Text>();
                text.text = option.text;
                btn.onClick.AddListener(() => option.dialogue.Advance());
                break;
            }
        }
    }
}
