1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
using Godot; using System; public partial class UI : Node { private TextureProgressBar hpBar; public override void _Ready() { base._Ready(); hpBar = GetNode<TextureProgressBar>("CanvasLayer/MainContainer/HPbar"); } public void OnHealthChanged(int hp, int maxHp) { hpBar.Value = hp; hpBar.MaxValue = maxHp; } }