예제 #1
0
        void HandleRestoreHealth(GameObject obj)
        {
            Damageable dam = obj.GetComponent <Damageable>();

            if (dam)
            {
                dam.SetHealth(dam.GetMaxHealth());
            }
            else
            {
                Debug.Log(obj.name + " is trying to restore health but doesn't have a damageable component");
            }
        }
예제 #2
0
 protected override void Update()
 {
     if (player)
     {
         Damageable dam = player.GetComponent <Damageable>();
         if (dam)
         {
             UpdateIcons(dam.GetHealth(), dam.GetMaxHealth());
         }
     }
     else
     {
         base.Update();
     }
 }