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

public class HealthBar : MonoBehaviour {

    Player player;

	// Use this for initialization
	void Start () {
        player = GameObject.FindObjectOfType<Player>();
	}
	
	// Update is called once per frame
	void Update () {
        if (player == null || !player.gameObject.activeSelf)
            transform.localScale = new Vector3(0, 1, 1);
        else
            transform.localScale = new Vector3(player.healthRatio, 1, 1);
	}
}
