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

public class InfoMeter : MonoBehaviour
{
    public TextMeshPro NameText;
    public TextMeshPro LevelText;
    public GameObject HpFill;
    public GameObject MpFill;
    
    public void UpdateInfo(Entity e)
    {
        if (e.Stat.LVL > 0)
        {
            LevelText.text = e.Stat.LVL.ToString();
        }
        NameText.text = e.Name;
        float hp = 1;
        if (e.Stat.HP != 0)
        {
            hp = (float)e.HP / e.Stat.HP;
        }
        float mp = 1;
        if (e.Stat.MP != 0)
        {
            mp = (float)e.MP / e.Stat.MP;
        }
        HpFill.transform.localScale = new Vector3(hp, 1, 1);
        MpFill.transform.localScale = new Vector3(mp, 1, 1);
    }
}
