using System.Collections;
using UnityEngine;
using UnityEngine.Playables;

public class InterrogationTable : MonoBehaviour, IInteractable
{
    public Dialogue dialogue;
    private string[] lines;
    private bool hasInteracted = false;
    private bool manThere = false;
    [SerializeField] private GameObject bubbleBlower;

    public void Interact()
    {
        if(!hasInteracted && !manThere)
        {
            lines = new string[]{"The table looks empty."};
            dialogue.StartDialogue(lines);
        }
        else if(!hasInteracted && manThere)
        {
            lines = new string[]{"The breeze can only drift it so far..."};
            dialogue.StartDialogue(lines, "Old Man", this.gameObject, "OldManRoom1");
        }
        else
        {
            lines = new string[]{"Guess I'd better go look for his bubble blower..."};
            dialogue.StartDialogue(lines);
        }
    }

    public void CellOpened()
    {
        manThere = true;
    }

    public void OldManRoom1()
    {
        lines = new string[]{
            "Huh? Uh…",
            "...I’m sorry that you have to go this way 784. You really never bothered anyone.",
            "I still wonder to this day how you got into this mess.",
            "Do you have any requests before your execution? Most people just request a final meal."
        };
        dialogue.StartDialogue(lines, "Officer", this.gameObject, "OldManRoom2");
    }

    public void OldManRoom2()
    {
        lines = new string[]{"Can you bring it the magic rod from which it was first blown?"};
        dialogue.StartDialogue(lines, "Old Man", this.gameObject, "OldManRoom3");
    }

    public void OldManRoom3()
    {
        lines = new string[]{"Uh… I guess?"};
        dialogue.StartDialogue(lines, "Officer", this.gameObject, "SpawnBubbleBlower");
        hasInteracted = true;
    }

    public void SpawnBubbleBlower()
    {
        bubbleBlower.SetActive(true);
    }


}
