Player ui stuff
This commit is contained in:
@@ -69,10 +69,6 @@ namespace GameJamDungeon
|
||||
|
||||
[Node] public Label VTNumber { get; set; } = default!;
|
||||
|
||||
[Node] public ProgressBar HPBar { get; set; } = default!;
|
||||
|
||||
[Node] public ProgressBar VTBar { get; set; } = default!;
|
||||
|
||||
[Node] public IArea3D CollisionDetector { get; set; } = default!;
|
||||
|
||||
private AutoProp<double> _currentHP { get; set; } = default!;
|
||||
@@ -103,11 +99,6 @@ namespace GameJamDungeon
|
||||
_currentHP.Sync += OnHPChanged;
|
||||
_currentVT.Sync += OnVTChanged;
|
||||
|
||||
HPBar.MaxValue = PlayerStatInfo.MaximumHP;
|
||||
HPBar.Value = _currentHP.Value;
|
||||
VTBar.MaxValue = PlayerStatInfo.MaximumVT;
|
||||
VTBar.Value = _currentVT.Value;
|
||||
|
||||
HealthTimer.Timeout += OnHealthTimerTimeout;
|
||||
CollisionDetector.AreaEntered += OnEnemyHitBoxEntered;
|
||||
}
|
||||
@@ -222,8 +213,7 @@ namespace GameJamDungeon
|
||||
|
||||
private void OnHPChanged(double newHP)
|
||||
{
|
||||
HPNumber.Text = Mathf.RoundToInt(newHP).ToString();
|
||||
HPBar.Value = newHP;
|
||||
HPNumber.Text = $"{Mathf.RoundToInt(newHP)}/{PlayerStatInfo.MaximumHP}";
|
||||
|
||||
if (newHP <= 0.0)
|
||||
{
|
||||
@@ -234,8 +224,7 @@ namespace GameJamDungeon
|
||||
|
||||
private void OnVTChanged(int newVT)
|
||||
{
|
||||
VTNumber.Text = newVT.ToString();
|
||||
VTBar.Value = newVT;
|
||||
VTNumber.Text = $"{newVT}/{PlayerStatInfo.MaximumVT}";
|
||||
}
|
||||
|
||||
private void OnPlayerPositionUpdated(Vector3 globalPosition) => GlobalPosition = globalPosition;
|
||||
|
||||
Reference in New Issue
Block a user