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

public class HpBar : MonoBehaviour
{
    public Health HP;
    private Slider Fill;
    private float m;
    private void Start()
    {
        Fill = transform.Find("Slider").GetComponent<Slider>();
        Fill.maxValue = HP.MaxHP;
        Fill.value = HP.Hp;
    }
    private void FixedUpdate()
    {
        Fill.maxValue = HP.MaxHP;
        Fill.value = Mathf.SmoothDamp(Fill.value, HP.Hp, ref m, 0.1f);
    }
}
