mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-24 09:08:23 -05:00
19 lines
441 B
C#
19 lines
441 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace UnityAtoms.Examples
|
|
{
|
|
[AddComponentMenu("Unity Atoms/Examples/HealthBar")]
|
|
public class HealthBar : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private IntConstant _maxHealth = null;
|
|
|
|
public void HealthChanged(int health)
|
|
{
|
|
GetComponent<Image>().fillAmount = 1.0f * health / _maxHealth.Value;
|
|
}
|
|
}
|
|
}
|