Beispiel #1
0
        /// <summary>
        /// Spawn a single batch of particles. (if paused == false then Shoot is called every Update)
        /// </summary>
        public void Shoot()
        {
            waitList += particlesPerLoop; //Add new particles to waitlist

            //Spawn particles and empty waitlist
            int spawnQue = (int)waitList;
            waitList -= spawnQue;
            for (int i = 0; i < spawnQue; i++)
            {
                //Spawn a particle
                Particle newParticle = new Particle(ttl, new Vector2(MathHelper.Lerp(previousPosition.X, position.X, (float)GameManager.Random.NextDouble()), MathHelper.Lerp(previousPosition.Y, position.Y, (float)GameManager.Random.NextDouble())) + spawnShape.GetPosition(), beginSize, endSize, beginColor, endColor, texture, modifiers);
                //Set particle speed
                newParticle.SetSpeed(spawnSpeed.GetSpeed(this, newParticle));

                //Add particle to list
                particles.Add(newParticle);
            }
        }