using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class BuilderResourceDisplay : MonoBehaviour
{
    private TextMeshProUGUI amountText;
    private Image resourceImage;

    private void Awake()
    {
        amountText = GetComponentInChildren<TextMeshProUGUI>();
        resourceImage = GetComponentInChildren<Image>();
    }

    public void Initiate(CardData cardData, int amount)
    {
        amountText.text = amount.ToString();
        resourceImage.sprite = cardData.Prefab.GetComponent<SpriteRenderer>().sprite;
    }

    public void UpdateText(string newText)
    {
        amountText.text = newText;
    }
}
