public void Emit(ParticleParameters particleParameters, Vector2 position, Vector2 speed) { var particle = _particlePool.GetParticle(particleParameters); particle.Position = position; particle.Speed = speed; _particles.Add(particle); }
public void Reset(ParticleParameters particleParameters) { IsDestroyed = false; _particleParameters = particleParameters; _step = 1f / _particleParameters.Duration; _state = 0f; }
public Particle GetParticle(ParticleParameters particleParameters) { Particle particle; if (_particles.TryTake(out particle)) { particle.Reset(particleParameters); return particle; } return new Particle(particleParameters); }
public Particle(ParticleParameters particleParameters) { Reset(particleParameters); }