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

public class Tutorial : MonoBehaviour
{
    public TextMeshProUGUI tutorialText;
    public GameObject tutorialPanel;
    public bool pickedUpToothbrush = false;
    public bool candySpawned = false;

    private void Start()
    {
        StartCoroutine(TutorialC());
    }

    IEnumerator TutorialC()
    {
        tutorialPanel.SetActive(true);
        tutorialText.text = "WASD to walk";
        while(!Input.GetKey(KeyCode.W) && !Input.GetKey(KeyCode.S) && !Input.GetKey(KeyCode.A) && !Input.GetKey(KeyCode.D))
        {
            yield return null;
        }
        yield return new WaitForSeconds(1.0f);
        tutorialPanel.SetActive(false);

        while(!pickedUpToothbrush) { yield return null; }

        tutorialPanel.SetActive(true);
        tutorialText.text = "Left mouse to use toothbrush";

        while (!Input.GetMouseButton(0)) { yield return null; }
        yield return new WaitForSeconds(1.0f);

        tutorialText.text = "Clean all your teeth";
        yield return new WaitForSeconds(5.0f);

        tutorialPanel.SetActive(false);
    }

    public void PickUpToothbrush()
    {
        pickedUpToothbrush=true;
    }
}
