wave progress

This commit is contained in:
Rendo 2025-07-16 23:26:21 +05:00
commit 8287cf609a
10 changed files with 107 additions and 3 deletions

View file

@ -0,0 +1,26 @@
using Godot;
public partial class WaveProgress : TextureProgressBar
{
private TextureRect head;
private Tween tween;
[Export] private double progressTime = 2.0f;
public override void _Ready()
{
head = GetNode<TextureRect>("Head");
}
public void OnWaveChanged(int to)
{
if (Visible == false) Visible = true;
if (tween != null) tween.Kill();
tween = CreateTween().SetParallel(true).SetTrans(Tween.TransitionType.Cubic).SetEase(Tween.EaseType.Out);
tween.TweenProperty(this,"value",to+1,progressTime);
tween.TweenProperty(head,"anchor_right",1.0-(float)(to+1.0f)/MaxValue,progressTime);
tween.TweenProperty(head,"anchor_left",1.0-(float)(to+1.0f)/MaxValue,progressTime);
}
public void SetLevelData(AdventureLevelResource resource)
{
MaxValue = resource.waves.Count;
}
}

View file

@ -0,0 +1 @@
uid://bsnt4slsbathn