healthBar.cs 396 B

12345678910111213141516171819202122
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class healthBar : MonoBehaviour
  6. {
  7. public Slider slider;
  8. public void SetMaxHealth(int health)
  9. {
  10. slider.maxValue = health;
  11. slider.value = health;
  12. }
  13. public void SetHealth(int health)
  14. {
  15. slider.value = health;
  16. }
  17. }