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

public class PlayerhealthScript : MonoBehaviour
{
    HealthScript health;
    public Slider display;
    // Use this for initialization
    void Start()
    {
        health = GetComponent<HealthScript>();
        if (display != null)
        {
            display.maxValue = health.MaxHealth;
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (display != null)
        {
            display.value = health.GetHealth();
        }
        if (health.GetHealth() <= 0)
        {
            SceneManager.LoadScene("LoseScene");
        }
    }
}
