100coding
4/5/2017 - 6:38 AM

17A98D53-D200-4B4B-B6CC-691BF0AF8D71

17A98D53-D200-4B4B-B6CC-691BF0AF8D71

using UnityEngine;

public class ShipHealthHandler : MonoBehaviour
{
    private float health = 100;

    private void OnGUI()
    {
        var rect = new Rect(Screen.width / 2, Screen.height / 2, 200, 100);
        GUI.Label(rect, "Health : " + this.health);
    }

    public void Take_damage(float damage)
    {
        this.health -= damage;
    }
}