Files
FPS/Scripts/PlayerHUD.cs
2023-08-04 11:30:18 -07:00

19 lines
436 B
C#

using System.Linq;
using Godot;
public partial class PlayerHUD : CanvasLayer
{
private int _currentAmmo = 30;
public override void _Ready()
{
var ammoLabel = GetChildren().Single(x => x.Name == "AmmoLabel") as Label;
ammoLabel.Text = $"{_currentAmmo}/30";
}
public void OnFireGun()
{
var ammoLabel = GetChildren().Single(x => x.Name == "AmmoLabel") as Label;
ammoLabel.Text = $"{--_currentAmmo}/30";
}
}