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

public class HealthBar : ConjureUIElement
{
    [SerializeField] private Image img_fill;
    [SerializeField] private Image img_fillWhite;
    [SerializeField] private float imgWhiteFillSpeed = 1f;

    private float targetFillAmount;

    protected override void Awake()
    {
        base.Awake();

        img_fill.fillAmount = 1f;
        img_fillWhite.fillAmount = 1f;
    }

    private void Update()
    {
        img_fillWhite.fillAmount = Mathf.Lerp(img_fillWhite.fillAmount, targetFillAmount, Time.deltaTime * imgWhiteFillSpeed);
    }

    public void SetFillingAmount(float fillingAmount) 
    {
        targetFillAmount = fillingAmount;
        img_fill.fillAmount = targetFillAmount;
    }

    public void SetFillingColor(Color newColor) 
    {
        img_fill.color = newColor;
    }
}