17 lines
359 B
C#
Raw Normal View History

2018-11-12 22:15:14 +01:00
using UnityEngine;
using UnityEngine.UI;
using UnityAtoms;
namespace UnityAtoms.Examples
{
public class HealthBar : MonoBehaviour
{
[SerializeField]
private IntConstant MaxHealth;
public void HealthChanged(int health)
{
GetComponent<Image>().fillAmount = 1.0f * health / MaxHealth.Value;
}
}
}