droppable items and win
This commit is contained in:
parent
0f6445d677
commit
5bdbfa4d82
47 changed files with 820 additions and 85 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
|
|
@ -12,10 +13,32 @@ public partial class FastForwardButton : Button
|
|||
|
||||
private int speed = 1;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
RuntimeLevelData.Instance.OnLevelStateChanged += OnLevelStateChanged;
|
||||
}
|
||||
|
||||
private void OnLevelStateChanged(RuntimeLevelData.LevelStates state)
|
||||
{
|
||||
if (state == RuntimeLevelData.LevelStates.Game) return;
|
||||
|
||||
speed = 1;
|
||||
Update();
|
||||
}
|
||||
|
||||
public void OnPressed()
|
||||
{
|
||||
speed = Mathf.Wrap(speed+1, 1, 4);
|
||||
if (RuntimeLevelData.Instance.GetLevelState() != RuntimeLevelData.LevelStates.Game) return;
|
||||
|
||||
speed = Mathf.Wrap(speed + 1, 1, 4);
|
||||
|
||||
flashAnimator.Play("flash");
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
switch (speed)
|
||||
{
|
||||
case 1:
|
||||
|
|
@ -29,8 +52,6 @@ public partial class FastForwardButton : Button
|
|||
break;
|
||||
}
|
||||
|
||||
flashAnimator.Play("flash");
|
||||
|
||||
Engine.TimeScale = speed;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue