Skip to content

Commit

Permalink
chore: Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagomvas committed Jun 18, 2024
1 parent 00bc197 commit 7c4d854
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Basalt/Common/Components/BaseParticleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Basalt.Common.Entities;
using Basalt.Types;
using System.Drawing;
using System.Numerics;

namespace Basalt.Common.Components
Expand Down Expand Up @@ -94,7 +95,8 @@ public override void OnUpdate()
{
var dt = Time.DeltaTime;
_systemLifetime += dt;
if (!Looping && _systemLifetime > SystemDuration)

if (!Looping && _systemLifetime > SystemDuration + ParticleLifetime)
return;

for (int i = 0; i < _particles.Length; i++)
Expand All @@ -104,6 +106,12 @@ public override void OnUpdate()
_particleUpdate?.Invoke(ref _particles[i]);
if (_particles[i].Lifetime > ParticleLifetime)
{
if (!Looping && _systemLifetime > SystemDuration)
{
_particles[i] = defaults;
_particles[i].Color = Color.FromArgb(0x00000000);
continue;
}
_particles[i] = defaults;
_onParticleReset?.Invoke(ref _particles[i]);
}
Expand Down

0 comments on commit 7c4d854

Please sign in to comment.