using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class ActionButtonUI : MonoBehaviour
{
    [SerializeField] private TextMeshProUGUI textMeshPro;
    [SerializeField] private Button button;
    [SerializeField] private Image selectedImage;
    private BaseAction baseAction;

    public void SetBaseAction (BaseAction baseAction){
        textMeshPro.text = baseAction.GetActionName().ToUpper();
        this.baseAction = baseAction;
        button.onClick.AddListener(() => {
            UnitActionSystem.Instance.SetSelectedAction(baseAction);
        });
    }
    public void UpdateSelectedVisual() {
        selectedImage.enabled = (UnitActionSystem.Instance.GetSelectedAction() == baseAction);
    }
}