36 lines
747 B
C#
36 lines
747 B
C#
using Godot;
|
|
|
|
namespace Newlon.Components.GUI;
|
|
|
|
public partial class FastForwardButton : Button
|
|
{
|
|
[Export] private Texture2D firstSpeed;
|
|
[Export] private Texture2D secondSpeed;
|
|
[Export] private Texture2D thirdSpeed;
|
|
|
|
[Export] private AnimationPlayer flashAnimator;
|
|
|
|
private int speed = 1;
|
|
|
|
public void OnPressed()
|
|
{
|
|
speed = Mathf.Wrap(speed+1, 1, 4);
|
|
|
|
switch (speed)
|
|
{
|
|
case 1:
|
|
Icon = firstSpeed;
|
|
break;
|
|
case 2:
|
|
Icon = secondSpeed;
|
|
break;
|
|
case 3:
|
|
Icon = thirdSpeed;
|
|
break;
|
|
}
|
|
|
|
flashAnimator.Play("flash");
|
|
|
|
Engine.TimeScale = speed;
|
|
}
|
|
}
|