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

public class HealthBarScript : MonoBehaviour {

    private Image i;
    public Player p;
    Sprite[] healthbar;

    // Use this for initialization
    void Start () {
        i = GetComponent<Image>();
        healthbar = Resources.LoadAll<Sprite>("UI/healthbar");
    }
	
	// Update is called once per frame
	void Update () {
        i.sprite = healthbar[p.health];
	}
}
