cirnogodot/Scripts/Components/AutodeleteParticle.cs

27 lines
469 B
C#
Raw Normal View History

2025-02-12 16:20:55 +01:00
using Godot;
namespace Cirno.Scripts.Components;
public partial class AutodeleteParticle : GpuParticles2D
{
[Export]
public double LifeTime { get; private set; }
private double _timer = 0;
public void Init()
{
this.Emitting = true;
}
public override void _Process(double delta)
{
_timer += delta;
if (_timer >= LifeTime || this.Emitting == false)
{
QueueFree();
}
}
}