healthBar.cs 350 B

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