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

public class GameOverPanel : MonoBehaviour
{
    [SerializeField] private Text scoreText;
    [SerializeField] private Text highscoreText;
    [SerializeField] private GameObject newHighScore;
    [SerializeField] private GameObject againButton;

    public void Set(int score, int highscore, bool isNewHighscore)
    {
        againButton.SetActive(false);
        scoreText.text = score.ToString("N0");
        highscoreText.text = highscore.ToString("N0");
        newHighScore.SetActive(isNewHighscore);
    }

    void OnEnable()
    {
        StartCoroutine(ShowAgainButton());
    }

    IEnumerator ShowAgainButton()
    {
        yield return new WaitForSeconds(2f);
        againButton.SetActive(true);
    }

    public void New()
    {
        //GameManager.Instance.NewGame();
        UnityEngine.SceneManagement.SceneManager.LoadScene(0);
    }
}
