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

public class HealthDisplayer : MonoBehaviour {
    public Image health;
    public Color full;
    public Color deadish;

    HealthScript playerHealth;
	// Use this for initialization
	void Start () {
        playerHealth = GameObject.Find("player").GetComponent<HealthScript>();

	}
	
	// Update is called once per frame
	void Update () {
        float healthRatio = playerHealth.health / playerHealth.orighealth;
        health.fillAmount = healthRatio;
        health.color = Color.Lerp(deadish, full, healthRatio);
	}
}
