using UnityEngine;
using UnityEngine.UI;
using UniRx;
using UnityAtoms.BaseAtoms;
namespace UnityAtoms.Examples
{
///
/// Simple healthbar script using UniRx.
///
public class HealthBarUniRx : MonoBehaviour
{
[SerializeField]
private IntVariable _health = null;
void Awake()
{
_health.ObserveChange().Subscribe(health =>
{
GetComponent().fillAmount = 1.0f * health / _health.InitialValue;
});
}
}
}