using cfg;
using SimpleJSON;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;

public class GameManager : MonoBehaviour
{
    public static GameManager instance;
    public float gameTime;
    public Tables allCfgData;

    private JSONNode Loader(string fileName)
    {
        return JSON.Parse(File.ReadAllText("GenerateDatas/json/" + fileName + ".json"));
    }

    public void GetAllExcel()
    {
        allCfgData = new Tables(Loader);
    }

    private void Awake()
    {
        if (!instance)
        {
            instance = this;
        }
        else
        {
            DestroyImmediate(gameObject);
            return;
        }
    }

    private void Start()
    {
        gameTime = 0;
        GetAllExcel();
    }

    private void FixedUpdate()
    {
        gameTime += Time.deltaTime;
        EnemyCreater.instance.OnGameTimeChange(gameTime);
    }
}
