Player died & Round & Respawn

This commit is contained in:
2024-08-09 11:43:03 +08:00
parent cf6b4b0273
commit 6b48561f45
8 changed files with 262 additions and 87 deletions

View File

@ -18,6 +18,14 @@ public partial class HUD : Control
public override void _Process(double delta)
{
var roundBar = GetNode<ProgressBar>("BottomBox/ProgressBar");
roundBar.Value = World.RoundProgress * 100;
var roundLabel = GetNode<Label>("BottomBox/HBox/RoundLabel");
var roundSecLabel = GetNode<Label>("BottomBox/HBox/RoundSecondLabel");
roundLabel.Text = $"Round {World.RoundCount}";
roundSecLabel.Text = World.RoundTimeLeft.ToString("F2");
var player = World.GetCurrentPlayer();
if (player == null) return;
@ -37,5 +45,8 @@ public partial class HUD : Control
ammoLabel.Text = player.IsReloading
? $"Reloading... {player.TimeRemainingOfReload:F2}"
: $"Ammo {player.AmmoAmount}/{player.MaxAmmoAmount}";
var positionLabel = GetNode<Label>("BottomBox/HBox/PositionLabel");
positionLabel.Text = $"({player.Position.X:F2}, {player.Position.Y:F2})";
}
}