您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

28 行
656 B

using UnityEngine;
using UnityEngine.UI;
public class CharacterHealthUI : MonoBehaviour
{
public HealthState health;
public void UpdateUI()
{
if (m_Health != health.health)
{
m_Health = health.health;
m_HealthText.text = (Mathf.CeilToInt(m_Health)).ToString();
}
if (m_MaxHealth != health.maxHealth)
{
m_MaxHealth = health.maxHealth;
m_MaxHealthText.text = "/" + ((int)m_MaxHealth).ToString();
}
}
[SerializeField] Text m_HealthText;
[SerializeField] Text m_MaxHealthText;
float m_Health = -1;
float m_MaxHealth = -1;
}