public static void ReturnSource(ref Particles source) { particlesPool.Push(source.particles); vertexDataPool.Push(source.vertexData); source.Effect = null; source.particles = null; source.vertexData = null; source = null; }
public static Particles CreateSource(Vector2 position, int count) { Particles source = new Particles(position, count); source.particles = particlesPool.Count < 1 ? new Particle[Capacity] : particlesPool.Pop(); source.vertexData = vertexDataPool.Count < 1 ? new PositionColor[Capacity * Particle.MaxVertices] : vertexDataPool.Pop(); source.EmitParticles(); return(source); }