Exemple #1
0
        internal void Draw(float elapsedTime, SpriteBatch spriteBatch, Camera cam)
        {
            timeUntilSmokeTime += elapsedTime / 1000;

            explosion.Update(elapsedTime);
            shockWaveAnimation.Update(elapsedTime);

            spriteBatch.Draw(shockWave, cam.getVisualCordinates(particleStartPosition),
                             shockWave.Bounds, new Color(shockWaveAnimation.Fade, shockWaveAnimation.Fade, shockWaveAnimation.Fade, shockWaveAnimation.Fade),
                             0, new Vector2(shockWave.Bounds.Width / 2, shockWave.Bounds.Height / 2), shockWaveAnimation.getScale(cam, shockWave.Bounds.Width),
                             SpriteEffects.None, 0);

            spriteBatch.Draw(boom, cam.getRectangle(particleStartPosition, scale),
                 new Rectangle((int)(explosion.TexelWidth * explosion.FrameX), (int)(explosion.TexelHeight * explosion.FrameY), (int)explosion.TexelWidth, (int)explosion.TexelHeight),
                 Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);

            if (timeUntilSmokeTime >= smokeTime)
            {
                Update(elapsedTime);
                foreach (SmokeParticle particle in smokeArray)
                {
                    spriteBatch.Draw(smokeTexture,
                                cam.getVisualCordinates(particle.Position),
                                smokeTexture.Bounds, new Color(particle.Fade, particle.Fade, particle.Fade, particle.Fade),
                                particle.Rotation, new Vector2(smokeTexture.Bounds.Width / 2, smokeTexture.Bounds.Height),
                                particle.Size, SpriteEffects.None, 0);
                }
            }
        }