This commit is contained in:
2026-03-15 21:26:59 +01:00
parent 95616f61fc
commit 50de6abb5d
9 changed files with 52 additions and 15 deletions

View File

@@ -5,9 +5,10 @@ using Movementtests.interfaces;
[GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_text_panel.png")]
public partial class PlayerUi : Control
{
internal TextureRect[] _dashIcons = new TextureRect[3];
private TextureRect _enemyTarget;
private Healthbar _healthbar;
internal TextureRect[] DashIcons = new TextureRect[3];
private TextureRect _enemyTarget = null!;
private Healthbar _healthbar = null!;
private Healthbar _manabar = null!;
public enum TargetState
{
@@ -25,12 +26,13 @@ public partial class PlayerUi : Control
public override void _Ready()
{
_dashIcons[0] = GetNode<TextureRect>("%Dash1");
_dashIcons[1] = GetNode<TextureRect>("%Dash2");
_dashIcons[2] = GetNode<TextureRect>("%Dash3");
DashIcons[0] = GetNode<TextureRect>("%Dash1");
DashIcons[1] = GetNode<TextureRect>("%Dash2");
DashIcons[2] = GetNode<TextureRect>("%Dash3");
_enemyTarget = GetNode<TextureRect>("%EnemyTarget");
_healthbar = GetNode<Healthbar>("%Healthbar");
_manabar = GetNode<Healthbar>("%Manabar");
}
public void Initialize(float initialHealth)
@@ -59,7 +61,7 @@ public partial class PlayerUi : Control
public void SetNumberOfDashesLeft(int numberOfDashes)
{
int index = 1;
foreach (var dashIcon in _dashIcons)
foreach (var dashIcon in DashIcons)
{
dashIcon.SetVisible(index <= numberOfDashes);
index++;
@@ -70,4 +72,10 @@ public partial class PlayerUi : Control
{
_healthbar.CurrentHealth = healthChanged.CurrentHealth;
}
public void OnManaChanged(float newValue)
{
_manabar.CurrentHealth = newValue;
GD.Print("mana changed");
}
}