using UnityEngine; 
 using System.Collections; 
 public class EnemyHealth : MonoBehaviour { 
 public int MaxHealth = 100; 
 public int curHealth = 100; 
 public int Health = 100; 
 public float Screenwidth; 
 // Use this for initialization 
 void Start () { 
 } 
 
 // Update is called once per frame 
 void Update () { 
 AddjustCurrentHealth(0); 
 Screenwidth = Screen.width / 2; 
 
 
 } 
 void OnGUI(){ 
 GUI.Box(new Rect(10, 40, Screenwidth, 20), curHealth + "/" + MaxHealth); 
 
 } 
 
 public void AddjustCurrentHealth(int adj){ 
 curHealth += adj; 
 if (curHealth < 0){ 
 curHealth = 0; 
 } 
 if (curHealth > MaxHealth){ 
 curHealth = MaxHealth; 
 } 
 if (MaxHealth < 1){ 
 MaxHealth = 1; 
 } 
 Screenwidth = (Screen.width / 2) * ( curHealth / (float)MaxHealth); 
 
 } 
 
 
 }