using TMPro;
using UnityEngine;

public class GameManager : MonoBehaviour,ISceneInitializable
{
    public static GameManager Instance;

    public SkillSupport SkillSupporter {get; private set;}
    public PlayerController LocalPlayer {get; private set;}

    public WaveManager WaveM {get; private set;}

    public RestartUI Restart {get; private set;}


    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this; //만들어진 자신을 인스턴스로 설정
        }
        else
        {
            Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
        }
    }

    public void OnSceneLoaded()
    {
        SkillSupporter = Object.FindFirstObjectByType<SkillSupport>();
        LocalPlayer = Object.FindFirstObjectByType<PlayerController>();
        WaveM = Object.FindFirstObjectByType<WaveManager>();
        Restart = Object.FindFirstObjectByType<RestartUI>();
    }

    public void GameRestart()
    {
        Debug.Log("다시시작");

        SceneLoadManager.Instance.RequestSceneChange("GameScene");
    }
}
