Example #1
0
        // O(1) complexity, since there is no big loop to go through
        public void Create(double x, double y, double velocityX, double velocityY, int lifetime)
        {
            // Make sure the pool isn't full
            Debug.Assert(_firstAvilable != null);

            // remove if from the avilable list
            ParticleWithFreeList newParticle = _firstAvilable;

            _firstAvilable = newParticle.GetNext();

            newParticle.Initialize(x, y, velocityX, velocityY, lifetime);
        }