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

using TMPro;

using Bytes;
using System;

public class GainCurrency : MonoBehaviour
{
    [SerializeField] private Animator anim;
    [SerializeField] private TextMeshProUGUI txt_currencyAmountGained;

    private void Start()
    {
        EventManager.AddEventListener(EventNames.GainCurrency, HandleGainCurrency);
    }

    private void HandleGainCurrency(BytesData data)
    {
        int amount = (data as IntDataBytes).IntValue;

        txt_currencyAmountGained.text = "+ " + amount.ToString();
        anim.Play("CurrencyGain_Play");
    }
}
