UIHP.cs 373 B

123456789101112131415161718
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class UIHP : MonoBehaviour
  6. {
  7. public Image imgHp;
  8. public void Show(int hp, int totalHp)
  9. {
  10. imgHp.fillAmount = (float)hp / (float)totalHp;
  11. }
  12. public void Show(float hp, float totalHp)
  13. {
  14. imgHp.fillAmount = hp / totalHp;
  15. }
  16. }