using UnityEngine;
using System.Collections;

public class HealthBar : MonoBehaviour {

    private PlayerStats stats;
    private RectTransform rect;
	// Use this for initialization
	void Start () {
        stats = FindObjectOfType<PlayerStats>();
        rect = GetComponent<RectTransform>();
	}
	
	// Update is called once per frame
	void Update () {
        rect.localScale = new Vector3((float)(stats.health / stats.max_health), rect.localScale.y, rect.localScale.z);
	}
}
