using System.Collections; using System.Collections.Generic; using UnityEngine; [System.Serializable] public class Health : MonoBehaviour { private float maxValue; [SerializeField] private float amount = 10f; // an event to broadcast when the health changes // [SerializeField, Header("Register to know when my health changes.")] // an event to broadcast when the health expires // [SerializeField, Header("Register to know when my health expires.")] /// /// Gets or sets the health value /// public float Amount { get { return amount; } set { amount = value; // Broadcast events } } public float HealthPercent { get { return Amount / maxValue * 100; } } // Use this for initialization void Start () { maxValue = Amount; } // Update is called once per frame void Update () { } }