Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| edbd4a182b | |||
| f51275ccc0 | |||
| e864c62a3a |
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user