Adam Ramberg c3bc59259f More WIP
2020-03-02 02:26:06 +01:00

19 lines
436 B
C#

using UnityEngine;
using UnityEngine.UI;
using UnityAtoms.BaseAtoms;
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;
}
}
}