using System.Linq;
using Godot;

public partial class PlayerHUD : CanvasLayer
{
  public override void _Ready()
  {
    UpdateCurrentAmmo();
  }

  public void UpdateCurrentAmmo()
  {
    var gun = GetNode<Gun>("/root/Player/Gun");
    var ammoLabel = GetChildren().Single(x => x.Name == "AmmoLabel") as Label;
    ammoLabel.Text = $"{gun.CurrentAmmo}/30";
  }
}
