|
|
|
@ -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)
|
|
|
|
|