From a38db5e6ed5abbac3803dc5008e4aa48e99f7aee Mon Sep 17 00:00:00 2001 From: Mario Brandao Date: Mon, 1 Jan 2024 13:51:39 +0100 Subject: [PATCH] Added namespace --- scripts/MultiParticles.cs | 92 ++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/scripts/MultiParticles.cs b/scripts/MultiParticles.cs index 9811a0f..bda225c 100644 --- a/scripts/MultiParticles.cs +++ b/scripts/MultiParticles.cs @@ -1,60 +1,62 @@ using Godot; using System; -public partial class MultiParticles : Node3D +namespace GodotVisualEffects { - [Export] - public bool Emitting = true; + public partial class MultiParticles : Node3D + { + [Export] + public bool Emitting = true; - [Export] - public bool OneShot = false; + [Export] + public bool OneShot = false; - [Export] - public Godot.Collections.Array Particles; + [Export] + public Godot.Collections.Array Particles; - double Lifetime = 0.0f; + double Lifetime = 0.0f; - public override void _Ready() - { - if (Emitting) - { - StartEmitters(); - } - } + public override void _Ready() + { + if (Emitting) + { + StartEmitters(); + } + } - void GetLifetime() - { - foreach (var particle in Particles) - { - if (particle.Lifetime > Lifetime) - { - Lifetime = particle.Lifetime; - } - } - } + void GetLifetime() + { + foreach (var particle in Particles) + { + if (particle.Lifetime > Lifetime) + { + Lifetime = particle.Lifetime; + } + } + } - public async void StartEmitters() - { - GetLifetime(); + public async void StartEmitters() + { + GetLifetime(); - foreach (var particle in Particles) - particle.Emitting = true; + foreach (var particle in Particles) + particle.Emitting = true; - await ToSignal(GetTree().CreateTimer(Lifetime), SceneTreeTimer.SignalName.Timeout); - DisposeOfEmitters(); + await ToSignal(GetTree().CreateTimer(Lifetime), SceneTreeTimer.SignalName.Timeout); + DisposeOfEmitters(); - if (!OneShot) - { - StartEmitters(); - } - } - - void DisposeOfEmitters() - { - foreach (var particle in Particles) - { - particle.Emitting = false; - } - } + if (!OneShot) + { + StartEmitters(); + } + } + void DisposeOfEmitters() + { + foreach (var particle in Particles) + { + particle.Emitting = false; + } + } + } }