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

public class UI_Inventory : MonoBehaviour
{
    [SerializeField] private InventoryManager m_Inventory;
    [SerializeField] private Sprite[] m_Sprites;
    [SerializeField] private Image m_CurrentItem;
    [SerializeField] private AudioClip m_ChangeClip;

    // Start is called before the first frame update
    void Start()
    {
        m_Inventory = GameObject.FindGameObjectWithTag("Player").GetComponent<InventoryManager>();
        m_Inventory.ChangeEquipment += OnChangeEquipment;
    }

    private void OnChangeEquipment(Equipment newType)
    {
        m_CurrentItem.sprite = m_Sprites[(int)newType - 1];
        SoundManager.PlayOneShot(m_ChangeClip);
    }

}
