better healthbars and one for the player as well
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using Movementtests.interfaces;
|
||||
|
||||
public partial class PlayerUi : Control
|
||||
{
|
||||
private TextureRect[] _dashIcons = new TextureRect[3];
|
||||
private TextureRect _enemyTarget;
|
||||
private Healthbar _healthbar;
|
||||
|
||||
public enum TargetState
|
||||
{
|
||||
@@ -30,6 +32,12 @@ public partial class PlayerUi : Control
|
||||
_dashIcons[2] = GetNode<TextureRect>("%Dash3");
|
||||
|
||||
_enemyTarget = GetNode<TextureRect>("%EnemyTarget");
|
||||
_healthbar = GetNode<Healthbar>("%Healthbar");
|
||||
}
|
||||
|
||||
public void Initialize(float initialHealth)
|
||||
{
|
||||
_healthbar.Initialize(initialHealth);
|
||||
}
|
||||
|
||||
public void SetEnemyTargetProperties(TargetProperties targetProperties)
|
||||
@@ -59,5 +67,10 @@ public partial class PlayerUi : Control
|
||||
dashIcon.SetVisible(index <= numberOfDashes);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnHealthChanged(IHealthable healthable, HealthChangedRecord healthChanged)
|
||||
{
|
||||
_healthbar.CurrentHealth = healthChanged.CurrentHealth;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user