Exemplo n.º 1
0
        /// <summary>
        /// Initialize all of the particle systems used by this particle system class.
        /// </summary>
        private void AutoInitializeOtherParticleSystems()
        {
            _particleSystemManager = new ParticleSystemManager();

            // Create all the particle systems
            _debrisParticleSystem       = new ExplosionDebrisParticleSystem();
            _fireSmokeParticleSystem    = new ExplosionFireSmokeParticleSystem();
            _flashParticleSystem        = new ExplosionFlashParticleSystem();
            _flyingSparksParticleSystem = new ExplosionFlyingSparksParticleSystem();
            _roundSparksParticleSystem  = new ExplosionRoundSparksParticleSystem();
            _shockwaveParticleSystem    = new ExplosionShockwaveParticleSystem();
            _smokeTrailsParticleSystem  = new ExplosionSmokeTrailsParticleSystem();

            // Specify the order the particle systems should be drawn in
            _debrisParticleSystem.DrawOrder       = 100;
            _fireSmokeParticleSystem.DrawOrder    = 200;
            _flashParticleSystem.DrawOrder        = 200;
            _flyingSparksParticleSystem.DrawOrder = 200;
            _roundSparksParticleSystem.DrawOrder  = 200;
            _shockwaveParticleSystem.DrawOrder    = 200;
            _smokeTrailsParticleSystem.DrawOrder  = 200;

            // Add all of the particle systems to the manager
            _particleSystemManager.AddParticleSystem(_debrisParticleSystem);
            _particleSystemManager.AddParticleSystem(_fireSmokeParticleSystem);
            _particleSystemManager.AddParticleSystem(_flashParticleSystem);
            _particleSystemManager.AddParticleSystem(_flyingSparksParticleSystem);
            _particleSystemManager.AddParticleSystem(_roundSparksParticleSystem);
            _particleSystemManager.AddParticleSystem(_shockwaveParticleSystem);
            _particleSystemManager.AddParticleSystem(_smokeTrailsParticleSystem);

            // Initialize all of the particle systems
            _particleSystemManager.AutoInitializeAllParticleSystems(this.GraphicsDevice, this.ContentManager, null);
        }
Exemplo n.º 2
0
        protected override void AfterDestroy()
        {
            base.AfterDestroy();

            // Remove all particle systems from the manager and destroy it
            if (_particleSystemManager != null)
            {
                _particleSystemManager.RemoveAllParticleSystems();
                _particleSystemManager = null;
            }

            // Destroy all of the particle systems
            if (_debrisParticleSystem != null)
            {
                _debrisParticleSystem.Destroy();
                _debrisParticleSystem = null;
            }

            if (_fireSmokeParticleSystem != null)
            {
                _fireSmokeParticleSystem.Destroy();
                _fireSmokeParticleSystem = null;
            }

            if (_flashParticleSystem != null)
            {
                _flashParticleSystem.Destroy();
                _flashParticleSystem = null;
            }

            if (_flyingSparksParticleSystem != null)
            {
                _flyingSparksParticleSystem.Destroy();
                _flyingSparksParticleSystem = null;
            }

            if (_roundSparksParticleSystem != null)
            {
                _roundSparksParticleSystem.Destroy();
                _roundSparksParticleSystem = null;
            }

            if (_shockwaveParticleSystem != null)
            {
                _shockwaveParticleSystem.Destroy();
                _shockwaveParticleSystem = null;
            }

            if (_smokeTrailsParticleSystem != null)
            {
                _smokeTrailsParticleSystem.Destroy();
                _smokeTrailsParticleSystem = null;
            }
        }
Exemplo n.º 3
0
        protected override void AfterDestroy()
        {
            base.AfterDestroy();

            // Remove all particle systems from the manager and destroy it
            if (_particleSystemManager != null)
            {
                _particleSystemManager.RemoveAllParticleSystems();
                _particleSystemManager = null;
            }

            // Destroy all of the particle systems
            if (_debrisParticleSystem != null)
            {
                _debrisParticleSystem.Destroy();
                _debrisParticleSystem = null;
            }

            if (_fireSmokeParticleSystem != null)
            {
                _fireSmokeParticleSystem.Destroy();
                _fireSmokeParticleSystem = null;
            }

            if (_flashParticleSystem != null)
            {
                _flashParticleSystem.Destroy();
                _flashParticleSystem = null;
            }

            if (_flyingSparksParticleSystem != null)
            {
                _flyingSparksParticleSystem.Destroy();
                _flyingSparksParticleSystem = null;
            }

            if (_roundSparksParticleSystem != null)
            {
                _roundSparksParticleSystem.Destroy();
                _roundSparksParticleSystem = null;
            }

            if (_shockwaveParticleSystem != null)
            {
                _shockwaveParticleSystem.Destroy();
                _shockwaveParticleSystem = null;
            }

            if (_smokeTrailsParticleSystem != null)
            {
                _smokeTrailsParticleSystem.Destroy();
                _smokeTrailsParticleSystem = null;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initialize all of the particle systems used by this particle system class.
        /// </summary>
        private void AutoInitializeOtherParticleSystems()
        {
            _particleSystemManager = new ParticleSystemManager();

            // Create all the particle systems
            _debrisParticleSystem = new ExplosionDebrisParticleSystem();
            _fireSmokeParticleSystem = new ExplosionFireSmokeParticleSystem();
            _flashParticleSystem = new ExplosionFlashParticleSystem();
            _flyingSparksParticleSystem = new ExplosionFlyingSparksParticleSystem();
            _roundSparksParticleSystem = new ExplosionRoundSparksParticleSystem();
            _shockwaveParticleSystem = new ExplosionShockwaveParticleSystem();
            _smokeTrailsParticleSystem = new ExplosionSmokeTrailsParticleSystem();

            // Specify the order the particle systems should be drawn in
            _debrisParticleSystem.DrawOrder = 100;
            _fireSmokeParticleSystem.DrawOrder = 200;
            _flashParticleSystem.DrawOrder = 200;
            _flyingSparksParticleSystem.DrawOrder = 200;
            _roundSparksParticleSystem.DrawOrder = 200;
            _shockwaveParticleSystem.DrawOrder = 200;
            _smokeTrailsParticleSystem.DrawOrder = 200;
            
            // Add all of the particle systems to the manager
            _particleSystemManager.AddParticleSystem(_debrisParticleSystem);
            _particleSystemManager.AddParticleSystem(_fireSmokeParticleSystem);
            _particleSystemManager.AddParticleSystem(_flashParticleSystem);
            _particleSystemManager.AddParticleSystem(_flyingSparksParticleSystem);
            _particleSystemManager.AddParticleSystem(_roundSparksParticleSystem);
            _particleSystemManager.AddParticleSystem(_shockwaveParticleSystem);
            _particleSystemManager.AddParticleSystem(_smokeTrailsParticleSystem);

            // Initialize all of the particle systems
			_particleSystemManager.AutoInitializeAllParticleSystems(this.GraphicsDevice, this.ContentManager, null);
        }
Exemplo n.º 5
0
		/// <summary>
		/// Load your graphics content
		/// </summary>
		protected override void LoadContent()
		{
			mcSpriteBatch = new SpriteBatch(GraphicsDevice);

			// Load fonts and models for test application
			mcFont = Content.Load<SpriteFont>("Fonts/font");
			mcFloorModel = Content.Load<Model>("grid");
			mcSphereModel = Content.Load<Model>("SphereHighPoly");

			// Setup our render target to draw to when we want draws to persist across multiple frames
			_renderTarget = new RenderTarget2D(mcGraphics.GraphicsDevice, mcGraphics.PreferredBackBufferWidth, mcGraphics.PreferredBackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);

			// Specify vertices indicating positive axis directions
			int iLineLength = 50;
			msaAxisDirectionVertices = new VertexPositionColor[6];
			msaAxisDirectionVertices[0] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Red);
			msaAxisDirectionVertices[1] = new VertexPositionColor(new Vector3(iLineLength, 1, 0), Color.Red);
			msaAxisDirectionVertices[2] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Green);
			msaAxisDirectionVertices[3] = new VertexPositionColor(new Vector3(0, iLineLength, 0), Color.Green);
			msaAxisDirectionVertices[4] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Blue);
			msaAxisDirectionVertices[5] = new VertexPositionColor(new Vector3(0, 1, iLineLength), Color.Blue);
			
			mcAxisEffect = new BasicEffect(GraphicsDevice);
			mcAxisEffect.VertexColorEnabled = true;
			mcAxisEffect.LightingEnabled = false;
			mcAxisEffect.TextureEnabled = false;
			mcAxisEffect.FogEnabled = false;
			mcAxisVertexDeclaration = VertexPositionColor.VertexDeclaration;

			// Instantiate all of the Particle Systems
			mcDPSFSplashScreenParticleSystem = new DPSFSplashScreenParticleSystem(this);
			mcRandomParticleSystem = new RandomParticleSystem(this);
			mcFireParticleSystem = new FireParticleSystem(this);
			mcFireSpriteParticleSystem = new FireSpriteParticleSystem(this);
			mcSmokeParticleSystem = new SmokeParticleSystem(this);
			mcSnowParticleSystem = new SnowParticleSystem(this);
			mcSquarePatternParticleSystem = new SquarePatternParticleSystem(this);
			mcFountainParticleSystem = new FountainParticleSystem(this);
			mcRandom2DParticleSystem = new Random2DParticleSystem(this);
			mcGasFallParticleSystem = new GasFallParticleSystem(this);
			mcDotParticleSystem = new DotParticleSystem(this);
			mcFireworksParticleSystem = new FireworksParticleSystem(this);
			mcFigure8ParticleSystem = new Figure8ParticleSystem(this);
			mcStarParticleSystem = new StarParticleSystem(this);
			mcBallParticleSystem = new BallParticleSystem(this);
			mcRotatingQuadParticleSystem = new RotatingQuadsParticleSystem(this);
			mcBoxParticleSystem = new BoxParticleSystem(this);
			mcImageParticleSystem = new ImageParticleSystem(this);
			mcAnimatedQuadParticleSystem = new AnimatedQuadParticleSystem(this);
			mcSpriteParticleSystem = new SpriteParticleSystem(this);
			mcAnimatedSpriteParticleSystem = new AnimatedSpriteParticleSystem(this);
			mcQuadSprayParticleSystem = new QuadSprayParticleSystem(this);
			mcMagnetParticleSystem = new MagnetsParticleSystem(this);
			mcSparklerParticleSystem = new SparklerParticleSystem(this);
			mcGridQuadParticleSystem = new GridQuadParticleSystem(this);
			mcSphereParticleSystem = new SphereParticleSystem(this);
			mcMultipleImagesParticleSystem = new MultipleParticleImagesParticleSystem(this);
			mcMultipleImagesSpriteParticleSystem = new MultipleParticleImagesSpriteParticleSystem(this);
			mcExplosionFireSmokeParticleSystem = new ExplosionFireSmokeParticleSystem(this);
			mcExplosionFlashParticleSystem = new ExplosionFlashParticleSystem(this);
			mcExplosionFlyingSparksParticleSystem = new ExplosionFlyingSparksParticleSystem(this);
			mcExplosionSmokeTrailsParticleSystem = new ExplosionSmokeTrailsParticleSystem(this);
			mcExplosionRoundSparksParticleSystem = new ExplosionRoundSparksParticleSystem(this);
			mcExplosionDebrisParticleSystem = new ExplosionDebrisParticleSystem(this);
			mcExplosionShockwaveParticleSystem = new ExplosionShockwaveParticleSystem(this);
			mcExplosionParticleSystem = new ExplosionParticleSystem(this);
			mcTrailParticleSystem = new TrailParticleSystem(this);
			mcSpriteParticleSystemTemplate = new SpriteParticleSystemTemplate(this);
			mcSprite3DBillboardParticleSystemTemplate = new Sprite3DBillboardParticleSystemTemplate(this);
			mcQuadParticleSystemTemplate = new QuadParticleSystemTemplate(this);
			mcTexturedQuadParticleSystemTemplate = new TexturedQuadParticleSystemTemplate(this);
			mcDefaultSpriteParticleSystemTemplate = new DefaultSpriteParticleSystemTemplate(this);
			mcDefaultSprite3DBillboardParticleSystemTemplate = new DefaultSprite3DBillboardParticleSystemTemplate(this);
			mcDefaultQuadParticleSystemTemplate = new DefaultQuadParticleSystemTemplate(this);
			mcDefaultTexturedQuadParticleSystemTemplate = new DefaultTexturedQuadParticleSystemTemplate(this);

			mcDPSFSplashScreenParticleSystem.DrawOrder = 10;
			mcRandomParticleSystem.DrawOrder = 100;
			mcFireParticleSystem.DrawOrder = 200;
			mcFireSpriteParticleSystem.DrawOrder = 250;
			mcSmokeParticleSystem.DrawOrder = 300;
			mcSnowParticleSystem.DrawOrder = 400;
			mcSquarePatternParticleSystem.DrawOrder = 500;
			mcFountainParticleSystem.DrawOrder = 600;
			mcRandom2DParticleSystem.DrawOrder = 700;
			mcGasFallParticleSystem.DrawOrder = 800;
			mcDotParticleSystem.DrawOrder = 900;
			mcFireworksParticleSystem.DrawOrder = 1000;
			mcFigure8ParticleSystem.DrawOrder = 1100;
			mcStarParticleSystem.DrawOrder = 1200;
			mcBallParticleSystem.DrawOrder = 1300;
			mcRotatingQuadParticleSystem.DrawOrder = 1400;
			mcBoxParticleSystem.DrawOrder = 1500;
			mcImageParticleSystem.DrawOrder = 1600;
			mcAnimatedQuadParticleSystem.DrawOrder = 1700;
			mcSpriteParticleSystem.DrawOrder = 1800;
			mcAnimatedSpriteParticleSystem.DrawOrder = 1900;
			mcQuadSprayParticleSystem.DrawOrder = 1925;
			mcMagnetParticleSystem.DrawOrder = 1950;
			mcSparklerParticleSystem.DrawOrder = 1960;
			mcGridQuadParticleSystem.DrawOrder = 1980;
			mcSphereParticleSystem.DrawOrder = 1990;
			mcMultipleImagesParticleSystem.DrawOrder = 2000;
			mcMultipleImagesSpriteParticleSystem.DrawOrder = 2005;
			mcExplosionFireSmokeParticleSystem.DrawOrder = 2010;
			mcExplosionFlashParticleSystem.DrawOrder = 2020;
			mcExplosionFlyingSparksParticleSystem.DrawOrder = 2030;
			mcExplosionSmokeTrailsParticleSystem.DrawOrder = 2040;
			mcExplosionRoundSparksParticleSystem.DrawOrder = 2050;
			mcExplosionDebrisParticleSystem.DrawOrder = 2060;
			mcExplosionShockwaveParticleSystem.DrawOrder = 2070;
			mcExplosionParticleSystem.DrawOrder = 2080;
			mcTrailParticleSystem.DrawOrder = 2090;
			mcSpriteParticleSystemTemplate.DrawOrder = 2200;
			mcSprite3DBillboardParticleSystemTemplate.DrawOrder = 2300;
			mcQuadParticleSystemTemplate.DrawOrder = 2350;
			mcTexturedQuadParticleSystemTemplate.DrawOrder = 2400;
			mcDefaultSpriteParticleSystemTemplate.DrawOrder = 2600;
			mcDefaultSprite3DBillboardParticleSystemTemplate.DrawOrder = 2700;
			mcDefaultQuadParticleSystemTemplate.DrawOrder = 2750;
			mcDefaultTexturedQuadParticleSystemTemplate.DrawOrder = 2800;

			// Add all Particle Systems to the Particle System Manager
			mcParticleSystemManager.AddParticleSystem(mcDPSFSplashScreenParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcRandomParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcFireParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcFireSpriteParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSmokeParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSnowParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSquarePatternParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcFountainParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcRandom2DParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcGasFallParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcDotParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcFireworksParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcFigure8ParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcStarParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcBallParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcRotatingQuadParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcBoxParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcImageParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcAnimatedQuadParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSpriteParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcAnimatedSpriteParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcQuadSprayParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcMagnetParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSparklerParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcGridQuadParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSphereParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcMultipleImagesParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcMultipleImagesSpriteParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionFireSmokeParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionFlashParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionFlyingSparksParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionSmokeTrailsParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionRoundSparksParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionDebrisParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionShockwaveParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcExplosionParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcTrailParticleSystem);
			mcParticleSystemManager.AddParticleSystem(mcSpriteParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcSprite3DBillboardParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcQuadParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcTexturedQuadParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcDefaultSpriteParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcDefaultSprite3DBillboardParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcDefaultQuadParticleSystemTemplate);
			mcParticleSystemManager.AddParticleSystem(mcDefaultTexturedQuadParticleSystemTemplate);

			// Set how often the Particle Systems should be Updated
			mcParticleSystemManager.UpdatesPerSecond = miPARTICLE_SYSTEM_UPDATES_PER_SECOND;

			// Hide text and other things while displaying the Splash Screen
			mbShowText = false; mbShowFloor = false;

			// Setup the Splash Screen to display before anything else
			mcDPSFSplashScreenParticleSystem.AutoInitialize(this.GraphicsDevice, this.Content, null);
			mcDPSFSplashScreenParticleSystem.SplashScreenComplete += new EventHandler(mcDPSFSplashScreenParticleSystem_SplashScreenComplete);
			mcCurrentParticleSystem = mcDPSFSplashScreenParticleSystem;
		}