Merge pull request 'made dead fighters shrink to telegraph to the player that they are dead' (#25) from feature/dead_squash into develop

Reviewed-on: #25
pull/26/head
Jonathan 2 months ago
commit e1a61fb1e2

@ -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());
}
}

@ -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();
}
/// <summary>
/// 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()
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);
}

Loading…
Cancel
Save