using System.Linq;
using Godot;

public partial class Healthbar : Sprite3D
{
  public override void _Ready()
  {
    Texture = GetChildren().OfType<SubViewport>().Single().GetTexture();
  }

  public void Update(int amount, int full)
  {
    var progressBar = GetChildren().ElementAt(0).GetChildren().OfType<HealthbarProgress>().Single();
    progressBar.UpdateBar(amount, full);
  }
}
