Added damage fly number

This commit is contained in:
jonathan
2025-11-11 15:55:15 +01:00
parent 0507f1ee3d
commit 3bb4fcd129
10 changed files with 109 additions and 22 deletions
+10 -2
View File
@@ -19,7 +19,11 @@ public partial class FighterVisual : Node2D
[ExportCategory("References")]
[Export] private Node2D _visualParent = null!;
[Export] private Node2D _targetSelectionParent = null!;
[Export] private Node2D _squashParent = null!;
[Export] public FighterHealthBarVisual healthBarVisual = null!;
[Export] private FighterDamageIndicatorVisual _fighterDamageIndicatorVisual;
private FightWorld.Fighter _boundFighter;
@@ -75,8 +79,8 @@ public partial class FighterVisual : Node2D
public async Task AnimateHit()
{
var tween = GetTree().CreateTween();
tween.TweenProperty(this, "scale", new Vector2(1.4f, 0.6f), 0.15);
tween.TweenProperty(this, "scale", new Vector2(1, 1), 0.4)
tween.TweenProperty(_squashParent, "scale", new Vector2(1.4f, 0.6f), 0.15);
tween.TweenProperty(_squashParent, "scale", new Vector2(1, 1), 0.4)
.SetTrans(Tween.TransitionType.Cubic).SetEase(Tween.EaseType.Out);
await ToSignal(tween, "finished");
}
@@ -90,4 +94,8 @@ public partial class FighterVisual : Node2D
// tween.TweenProperty(this, "scale", new Vector2(1, 1), 0.4)
// .SetTrans(Tween.TransitionType.Cubic).SetEase(Tween.EaseType.Out);
//}
public void SpawnDamageIndicatorNumber(int number)
{
_fighterDamageIndicatorVisual.SpawnFlyingNumber(number);
}
}