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

public class CardDatabase 
{
    public List<Card> Cards = new List<Card>();

    public static CardDatabase Instance
    {
        get
        {
            if (_instance == null)
            {
                TextAsset jsonAsset = Resources.Load<TextAsset>("Cards");
                _instance = JsonUtility.FromJson<CardDatabase>(jsonAsset.text);

            }
            return _instance;
        }
    }
    private static CardDatabase _instance = null;


    public Card FindCardByName(string name)
    {
        foreach(Card c in Cards)
        {
            if (c.CardName == name)
                return c;
        }

        Debug.Log("WARNING: Could not find card named " + name);
        return null;
    }

    public CardDatabase()
    {

    }
}
