namespace Dancer; [Meta(typeof(IAutoNode))] public partial class PlayerHud : Control { public override void _Notification(int what) => this.Notify(what); [Export] private Player Player { get; set; } = null!; [Node] private TextureProgressBar HpBar { get; set; } = null!; [Node] private TextureProgressBar EnergyBar0 { get; set; } = null!; [Node] private TextureProgressBar EnergyBar1 { get; set; } = null!; [Node] private TextureProgressBar EnergyBar2 { get; set; } = null!; public void OnReady() => SetProcess(true); public void OnProcess(double delta) { HpBar.MinValue = 0f; HpBar.MaxValue = Player.MaxHealth; HpBar.Value = Player.Health; EnergyBar0.MinValue = 0f; EnergyBar0.MaxValue = 1f; EnergyBar0.Value = Mathf.Clamp(Player.DashPoints - 0f, 0f, 1f); EnergyBar1.MinValue = 0f; EnergyBar1.MaxValue = 1f; EnergyBar1.Value = Mathf.Clamp(Player.DashPoints - 1f, 0f, 1f); EnergyBar2.MinValue = 0f; EnergyBar2.MaxValue = 1f; EnergyBar2.Value = Mathf.Clamp(Player.DashPoints - 2f, 0f, 1f); } }