made dead fighters shrink to telegraph to the player that they are dead

pull/25/head
jonathan 2 months ago
parent e864c62a3a
commit f51275ccc0

@ -59,7 +59,7 @@ public partial class AllFightersVisual : Node
if (from == FightHappening.FightState.ActionAnim) if (from == FightHappening.FightState.ActionAnim)
{ {
_fighterVisuals.Values.ForEach(fv => fv.UpdateHealthBar()); _fighterVisuals.Values.ForEach(fv => fv.UpdateVisuals());
} }
} }

@ -7,7 +7,6 @@ using Godot.Collections;
namespace Babushka.scripts.CSharp.Common.Fight; namespace Babushka.scripts.CSharp.Common.Fight;
public partial class FighterVisual : Node2D public partial class FighterVisual : Node2D
{ {
#region Shortcuts #region Shortcuts
@ -28,22 +27,21 @@ public partial class FighterVisual : Node2D
public void Initialize(FightWorld.Fighter fighter) public void Initialize(FightWorld.Fighter fighter)
{ {
_boundFighter = fighter; _boundFighter = fighter;
UpdateMirrorState(); UpdateVisuals();
UpdateHealthBar();
} }
/// <summary> public void UpdateVisuals()
/// fighter visuals should always look to the right in the scene.
/// This function flips the sprites horizontally, when the fighter is an enemy.
/// </summary>
private void UpdateMirrorState()
{ {
_visualParent.Scale = new Vector2(_boundFighter.IsInFormation(HappeningData.enemyFighterFormation) ? -1 : 1, 1); // fighter visuals should always look to the right in the scene.
} // This function flips the sprites horizontally, when the fighter is an enemy.
_visualParent.Scale = new Vector2(
_boundFighter.IsInFormation(HappeningData.enemyFighterFormation) ? -1 : 1,
_boundFighter.IsDead() ? .3f : 1);
public void UpdateHealthBar()
{
healthBarVisual.UpdateHealth(_boundFighter.GetHealth(), _boundFighter.maxHealth); healthBarVisual.UpdateHealth(_boundFighter.GetHealth(), _boundFighter.maxHealth);
//if (_boundFighter.IsDead())
// _visualParent.Scale = new Vector2(1.4f, 0.3f);
} }
public void SetTargetSelectionActive(bool value) public void SetTargetSelectionActive(bool value)

Loading…
Cancel
Save