Exemplo n.º 1
0
        private static void Swap(CircularParticleArray list, int a, int b)
        {
            var tmp = list[a];

            list[a] = list[b];
            list[b] = tmp;
        }
Exemplo n.º 2
0
        private static void Swap(CircularParticleArray list, int index1, int index2)
        {
            var temp = list[index1];

            list[index1] = list[index2];
            list[index2] = temp;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Swaps 2 particles in the particle list
        /// </summary>
        /// <param name="list">The particle list</param>
        /// <param name="index1">The index of the first particle</param>
        /// <param name="index2">The index of the second particle</param>
        private static void Swap(CircularParticleArray list, int index1, int index2)
        {
            // Swap the particles using a temporary variable
            var temp = list[index1];

            list[index1] = list[index2];
            list[index2] = temp;
        }
Exemplo n.º 4
0
		/// <summary>
		/// Allows creation of particles.
		/// </summary>
		/// <param name="capacity">The maximum number of particles. An array of this size will be pre-allocated.</param>
		/// <param name="updateParticle">A delegate that lets you specify custom behaviour for your particles. Called once per particle, per frame.</param>
		public ParticleManager(int capacity, Action<Particle> updateParticle)
		{
			this.updateParticle = updateParticle;
			particleList = new CircularParticleArray(capacity);

			// Populate the list with empty particle objects, for reuse.
			for (int i = 0; i < capacity; i++)
				particleList[i] = new Particle();
		}
Exemplo n.º 5
0
 public ParticleManager(int capacity, Action <Particle> updateParticle)
 {
     this.updateParticle = updateParticle;
     particleList        = new CircularParticleArray(capacity);
     for (var i = 0; i < capacity; i++)
     {
         particleList[i] = new Particle();
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// </summary>
        /// <param name="capacity">Maximum number of particles.</param>
        /// <param name="updateParticle">A delegate to specify custom behaviour for you particles</param>
        public ParticleManager(int capacity, Action <Particle, GameTime> updateParticle)
        {
            this.updateParticle = updateParticle;
            particleList        = new CircularParticleArray(capacity);

            // initialize list with empty particles
            for (int i = 0; i < capacity; i++)
            {
                particleList [i] = new Particle();
            }
        }
Exemplo n.º 7
0
        public ParticleManager(int capacity, Action <Particle> updateParticle) // Constructor is the only place this class alocates memory
        {
            this.updateParticle = updateParticle;
            particleList        = new CircularParticleArray(capacity);

            // fill the list with empty particle's so that they can be easily reused
            for (int i = 0; i < capacity; i++)
            {
                particleList[i] = new Particle();
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Allows creation of particles.
        /// </summary>
        /// <param name="capacity">The maximum number of particles. An array of this size will be pre-allocated.</param>
        /// <param name="updateParticle">A delegate that lets you specify custom behaviour for your particles. Called once per particle, per frame.</param>
        public ParticleManager(int capacity, Action <Particle> updateParticle, GraphicsDeviceManager graphicsDeviceManager_)
        {
            graphicsDeviceManager = graphicsDeviceManager_;
            this.updateParticle   = updateParticle;
            particleList          = new CircularParticleArray(capacity);

            // Populate the list with empty particle objects, for reuse.
            for (int i = 0; i < capacity; i++)
            {
                particleList[i] = new Particle();
            }
        }
Exemplo n.º 9
0
        public ParticleManager(int capacity, Action <Particle> updateParticle, ComatoseGame root)
        {
            this.updateParticle = updateParticle;
            particleList        = new CircularParticleArray(capacity);

            game = root;
            // Populate the list with empty particle objects, for reuse
            for (int i = 0; i < capacity; i++)
            {
                particleList[i] = new Particle();
            }
        }