enemyHealthBar.cs 377 B

123456789101112131415161718
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class enemyHealthBar : MonoBehaviour
  5. {
  6. public enemyScript enemy;
  7. float timer=0;
  8. void Update()
  9. {
  10. if(timer >=0){ timer -= Time.deltaTime; return;}
  11. timer = 0.5f;
  12. enemy.healthBar.SetHealth(enemy.health, enemy.maxHealth);
  13. }
  14. }