mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-24 09:08:23 -05:00
17 lines
359 B
C#
17 lines
359 B
C#
|
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;
|
||
|
}
|
||
|
}
|
||
|
}
|