diff --git a/scripts/CSharp/Common/Fight/AllFightersVisual.cs b/scripts/CSharp/Common/Fight/AllFightersVisual.cs index e24f218..d015d2b 100644 --- a/scripts/CSharp/Common/Fight/AllFightersVisual.cs +++ b/scripts/CSharp/Common/Fight/AllFightersVisual.cs @@ -59,7 +59,7 @@ public partial class AllFightersVisual : Node if (from == FightHappening.FightState.ActionAnim) { - _fighterVisuals.Values.ForEach(fv => fv.UpdateHealthBar()); + _fighterVisuals.Values.ForEach(fv => fv.UpdateVisuals()); } } diff --git a/scripts/CSharp/Common/Fight/FighterVisual.cs b/scripts/CSharp/Common/Fight/FighterVisual.cs index b5924df..04d1002 100644 --- a/scripts/CSharp/Common/Fight/FighterVisual.cs +++ b/scripts/CSharp/Common/Fight/FighterVisual.cs @@ -7,7 +7,6 @@ using Godot.Collections; namespace Babushka.scripts.CSharp.Common.Fight; - public partial class FighterVisual : Node2D { #region Shortcuts @@ -28,21 +27,17 @@ public partial class FighterVisual : Node2D public void Initialize(FightWorld.Fighter fighter) { _boundFighter = fighter; - UpdateMirrorState(); - UpdateHealthBar(); + UpdateVisuals(); } - /// - /// fighter visuals should always look to the right in the scene. - /// This function flips the sprites horizontally, when the fighter is an enemy. - /// - private void UpdateMirrorState() + public void UpdateVisuals() { - _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); }