counter +1
This commit is contained in:
parent
0d0e16afa2
commit
92ebb2868d
11 changed files with 50 additions and 39 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using Godot;
|
||||
using Newlon.Components.GUI;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
|
||||
|
|
@ -6,8 +7,6 @@ namespace Newlon;
|
|||
|
||||
public partial class Sun : Area2D
|
||||
{
|
||||
public static Control Counter;
|
||||
|
||||
[Export] public int amount = 25;
|
||||
[Export] private Timer _deathTimer;
|
||||
[Export] private AnimationPlayer _rotation;
|
||||
|
|
@ -39,21 +38,22 @@ public partial class Sun : Area2D
|
|||
}
|
||||
public override void _MouseEnter()
|
||||
{
|
||||
if (Settings.SunClick) return;
|
||||
if (Settings.SunClick || scoring) return;
|
||||
ScoreSun();
|
||||
}
|
||||
private void ScoreSun()
|
||||
{
|
||||
_fade.Stop();
|
||||
scoring = true;
|
||||
|
||||
|
||||
RuntimeLevelData.Instance.AddSun(amount);
|
||||
|
||||
GetNode<ChannelPlayer>("SunPlayer").Play();
|
||||
var tween = CreateTween();
|
||||
tween.TweenInterval(0.1);
|
||||
tween.TweenProperty(this, "global_position", GetCanvasTransform().AffineInverse() * (Counter.GlobalPosition + Counter.PivotOffset), 0.5).SetTrans(Tween.TransitionType.Cubic).SetEase(Tween.EaseType.Out);
|
||||
tween.TweenProperty(this, "global_position", GetCanvasTransform().AffineInverse() * (SunCounter.Instance.sunImage.GlobalPosition + SunCounter.Instance.sunImage.PivotOffset), 0.5).SetTrans(Tween.TransitionType.Cubic).SetEase(Tween.EaseType.Out);
|
||||
tween.TweenCallback(Callable.From(() =>
|
||||
{
|
||||
RuntimeLevelData.Instance.AddSun(amount);
|
||||
SunCounter.Update();
|
||||
QueueFree();
|
||||
}));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue