wave progress
This commit is contained in:
parent
f8f4de8d89
commit
8287cf609a
10 changed files with 107 additions and 3 deletions
26
scripts/gui/WaveProgress.cs
Normal file
26
scripts/gui/WaveProgress.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
1
scripts/gui/WaveProgress.cs.uid
Normal file
1
scripts/gui/WaveProgress.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bsnt4slsbathn
|
||||
Loading…
Add table
Add a link
Reference in a new issue