using UnityEngine;

public class GameInitializer : MonoBehaviour
{
    [Header("Manager Prefabs")]
    public GameObject gameStateManagerPrefab;
    public GameObject sceneNavigationManagerPrefab;

    private void Awake()
    {
        // Initialize core game managers if they don't exist
        InitializeManagers();
    }

    private void InitializeManagers()
    {
        // Initialize GameStateManager
        if (GameStateManager.Instance == null)
        {
            if (gameStateManagerPrefab != null)
            {
                Instantiate(gameStateManagerPrefab);
            }
            else
            {
                // Create a basic GameStateManager if no prefab is provided
                GameObject gameStateObj = new GameObject("GameStateManager");
                gameStateObj.AddComponent<GameStateManager>();
            }
        }

        // Initialize SceneNavigationManager
        if (SceneNavigationManager.Instance == null)
        {
            if (sceneNavigationManagerPrefab != null)
            {
                Instantiate(sceneNavigationManagerPrefab);
            }
            else
            {
                // Create a basic SceneNavigationManager if no prefab is provided
                GameObject sceneNavObj = new GameObject("SceneNavigationManager");
                sceneNavObj.AddComponent<SceneNavigationManager>();
            }
        }
    }
}
