using ScrambleKit.Game;
using ScrambleKit.Hits;
using UnityEngine;

public class HeartPip : MonoBehaviour 
{
    public int FirstHPTracked;

    public Sprite FullHeart;
    public Sprite HalfHeart;
    public Sprite EmptyHeart;
    public Sprite BlankSpace;

    private SpriteRenderer rend;
    private HitPoints hp;

    void Start () 
	{
        rend = GetComponent<SpriteRenderer>();
        hp = GameInfo.Player.GetComponent<HitPoints>();
    }
	
	void Update () 
	{
		if(hp.MaxHP < FirstHPTracked)
        {
            rend.sprite = BlankSpace;
        }
        else if (hp.HP < FirstHPTracked)
        {
            rend.sprite = EmptyHeart;
        }
        else if (hp.HP == FirstHPTracked)
        {
            rend.sprite = HalfHeart;
        }
        else
        {
            rend.sprite = FullHeart;
        }
	}
}
