mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 09:35:34 +00:00
38 lines
No EOL
645 B
C#
38 lines
No EOL
645 B
C#
using Godot;
|
|
|
|
namespace Cirno.Scripts.Components;
|
|
|
|
public partial class AutodeleteParticle : GpuParticles2D
|
|
{
|
|
|
|
[Export]
|
|
public double LifeTime { get; private set; }
|
|
|
|
[Export]
|
|
public bool AutoStart { get; private set; }
|
|
|
|
private double _timer = 0;
|
|
|
|
public override void _Ready()
|
|
{
|
|
if (AutoStart)
|
|
{
|
|
Init();
|
|
}
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
this.Emitting = true;
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
_timer += delta;
|
|
|
|
if (_timer >= LifeTime || this.Emitting == false)
|
|
{
|
|
QueueFree();
|
|
}
|
|
}
|
|
} |