Particles system
This commit is contained in:
parent
30266b36cf
commit
0e5dee50f7
46 changed files with 643 additions and 200 deletions
22
scripts/components/particles/StandardParticles.cs
Normal file
22
scripts/components/particles/StandardParticles.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using Godot;
|
||||
|
||||
public partial class StandardParticles : Node2D
|
||||
{
|
||||
private int counter = 0;
|
||||
private int counterMax = 0;
|
||||
public override void _Ready()
|
||||
{
|
||||
foreach (GpuParticles2D emitter in GetChildren())
|
||||
{
|
||||
emitter.Emitting = true;
|
||||
counterMax += 1;
|
||||
emitter.Finished += MarkForDestruction;
|
||||
}
|
||||
}
|
||||
public void MarkForDestruction()
|
||||
{
|
||||
if (Engine.IsEditorHint()) return;
|
||||
if (++counter < counterMax) return;
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue