using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public enum DifficultyLevel
{
    easy, medium, hard,
}
public class GameManager : MonoBehaviour
{
    public DifficultyLevel difficultyLevel;
    public List<int> difficultyScores;
    public float Score; 
    public static GameManager instance;
    public bool isGameOver = false;
    public static UnityEvent DifficultyIncreased=new();
    public void Awake()
    {
        instance = this;
    }
    private void Start()
    {
        StartCoroutine(ScoreUpdateRoutine());
    }
    IEnumerator ScoreUpdateRoutine()
    {
        difficultyLevel = DifficultyLevel.easy;
        while (!isGameOver)
        {
            Score++;
            UIManager.instance.ScoreText.text = Score.ToString();
            if(Score > difficultyScores[(int)difficultyLevel] && (int)difficultyLevel< difficultyScores.Count-1)
            {
                difficultyLevel++;
                DifficultyIncreased.Invoke();
            }
            yield return new WaitForSeconds(1);
        }
    }
}
