19 lines
436 B
C#
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";
|
|
}
|
|
}
|