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

public class DialogController : MonoBehaviour
{
    public string[] dialogs;
    private int dialog_idx;
    public Text dialog_text;
    // Start is called before the first frame update
    void Start()
    {
        dialog_idx = 0;
        dialog_text.text = dialogs[dialog_idx];
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            dialog_idx++;
            if (dialog_idx < dialogs.Length)
            {
                dialog_text.text = dialogs[dialog_idx];
            }
            else
            {
                string scene_name = SceneManager.GetActiveScene().name;
                if (scene_name.Equals("DialogIntro"))
                {
                    SceneManager.LoadScene("GameScene_lv1");
                }else if (scene_name.Equals("DialogIntro_2"))
                {
                    SceneManager.LoadScene("GameScene_lv3");
                }

            }
        }
    }



}
