Teleporter animation

This commit is contained in:
Marco 2025-02-07 15:43:02 +01:00
commit 50c111ee28
10 changed files with 111 additions and 52 deletions

View file

@ -23,6 +23,8 @@ public partial class Teleporter : Activable
private double _particleTimer;
private AnimatedSprite2D _animatedSprite;
// [Export]
// public GpuParticles2D Particles { get; set; }
@ -31,10 +33,20 @@ public partial class Teleporter : Activable
public override void _Ready()
{
_particles = GetNode<GpuParticles2D>("./Particles");
_animatedSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
IsPrimed = true;
_particles.Emitting = false;
_particleTimer = 0;
if (IsEnabled)
{
_animatedSprite.Play("Active");
}
else
{
_animatedSprite.Play("Default");
}
}
public override void _Process(double delta)
@ -60,9 +72,11 @@ public partial class Teleporter : Activable
case ActivationType.Enable:
// Enables Teleporter
IsEnabled = true;
_animatedSprite.Play("Active");
break;
case ActivationType.Disable:
IsEnabled = false;
_animatedSprite.Play("Default");
// Disables Teleporter
break;
case ActivationType.Use: