unity-atoms/Assets/UnityAtoms/Examples/Intro/Scripts/HealthBar.cs
2018-11-12 22:19:12 +01:00

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;
}
}
}