コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DPFSParticleSystem"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="IDPSFParticleSystem">The IDPSF particle system.</param>
 public DPFSParticleSystem(String name, IDPSFParticleSystem IDPSFParticleSystem)
     : base(name)
 {
     if (IDPSFParticleSystem == null)
     {
         ActiveLogger.LogMessage("IDPSFParticleSystem cannot be null", LogLevel.FatalError);
         throw new Exception("IDPSFParticleSystem cannot be null");
     }
     this.IDPSFParticleSystem = IDPSFParticleSystem;
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DPFSParticleSystem"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="IDPSFParticleSystem">The IDPSF particle system.</param>
 public DPFSParticleSystem(String name, IDPSFParticleSystem IDPSFParticleSystem)
     : base(name)
 {
     if (IDPSFParticleSystem == null)
     {
         ActiveLogger.LogMessage("IDPSFParticleSystem cannot be null", LogLevel.FatalError);
         throw new Exception("IDPSFParticleSystem cannot be null");
     }
     this.IDPSFParticleSystem = IDPSFParticleSystem;
 }
コード例 #3
0
		public void InitializeCurrentParticleSystem()
		{
			// If the Current Particle System has been set
			if (mcCurrentParticleSystem != null)
			{
				// Destroy the Current Particle System.
				// This frees up any resources/memory held by the Particle System, so it's
				// good to destroy them if we know they won't be used for a while.
				mcCurrentParticleSystem.Destroy();
			}

			// Initialize the Current Particle System
			switch (meCurrentPS)
			{
				default:
				case EPSEffects.Random: mcCurrentParticleSystem = mcRandomParticleSystem; break;
				case EPSEffects.Fire: mcCurrentParticleSystem = mcFireParticleSystem; break;
				case EPSEffects.FireSprite: mcCurrentParticleSystem = mcFireSpriteParticleSystem; break;
				case EPSEffects.Smoke: mcCurrentParticleSystem = mcSmokeParticleSystem; break;
				case EPSEffects.Snow: mcCurrentParticleSystem = mcSnowParticleSystem; break;
				case EPSEffects.SquarePattern: mcCurrentParticleSystem = mcSquarePatternParticleSystem; break;
				case EPSEffects.Fountain: mcCurrentParticleSystem = mcFountainParticleSystem; break;
				case EPSEffects.Random2D: mcCurrentParticleSystem = mcRandom2DParticleSystem; break;
				case EPSEffects.GasFall: mcCurrentParticleSystem = mcGasFallParticleSystem; break;
				case EPSEffects.Dot: mcCurrentParticleSystem = mcDotParticleSystem; break;
				case EPSEffects.Fireworks: mcCurrentParticleSystem = mcFireworksParticleSystem; break;
				case EPSEffects.Figure8: mcCurrentParticleSystem = mcFigure8ParticleSystem; break;
				case EPSEffects.Star: mcCurrentParticleSystem = mcStarParticleSystem; break;
				case EPSEffects.Ball: mcCurrentParticleSystem = mcBallParticleSystem; break;
				case EPSEffects.RotatingQuad: mcCurrentParticleSystem = mcRotatingQuadParticleSystem; break;
				case EPSEffects.Box: mcCurrentParticleSystem = mcBoxParticleSystem; break;
				case EPSEffects.Image: mcCurrentParticleSystem = mcImageParticleSystem; break;
				case EPSEffects.AnimatedTexturedQuad: mcCurrentParticleSystem = mcAnimatedQuadParticleSystem; break;
				case EPSEffects.Sprite: mcCurrentParticleSystem = mcSpriteParticleSystem; break;
				case EPSEffects.AnimatedSprite: mcCurrentParticleSystem = mcAnimatedSpriteParticleSystem; break;
				case EPSEffects.QuadSpray: mcCurrentParticleSystem = mcQuadSprayParticleSystem; break;
				case EPSEffects.Magnets: mcCurrentParticleSystem = mcMagnetParticleSystem; break;
				case EPSEffects.Sparkler: mcCurrentParticleSystem = mcSparklerParticleSystem; break;
				case EPSEffects.GridQuad: mcCurrentParticleSystem = mcGridQuadParticleSystem; break;
				case EPSEffects.Sphere: mcCurrentParticleSystem = mcSphereParticleSystem; break;
				case EPSEffects.MultipleParticleImages: mcCurrentParticleSystem = mcMultipleImagesParticleSystem; break;
				case EPSEffects.MultipleParticleImagesSprite: mcCurrentParticleSystem = mcMultipleImagesSpriteParticleSystem; break;
				case EPSEffects.ExplosionFireSmoke: mcCurrentParticleSystem = mcExplosionFireSmokeParticleSystem; break;
				case EPSEffects.ExplosionFlash: mcCurrentParticleSystem = mcExplosionFlashParticleSystem; break;
				case EPSEffects.ExplosionFlyingSparks: mcCurrentParticleSystem = mcExplosionFlyingSparksParticleSystem; break;
				case EPSEffects.ExplosionSmokeTrails: mcCurrentParticleSystem = mcExplosionSmokeTrailsParticleSystem; break;
				case EPSEffects.ExplosionRoundSparks: mcCurrentParticleSystem = mcExplosionRoundSparksParticleSystem; break;
				case EPSEffects.ExplosionDebris: mcCurrentParticleSystem = mcExplosionDebrisParticleSystem; break;
				case EPSEffects.ExplosionShockwave: mcCurrentParticleSystem = mcExplosionShockwaveParticleSystem; break;
				case EPSEffects.Explosion: mcCurrentParticleSystem = mcExplosionParticleSystem; break;
				case EPSEffects.Trail: mcCurrentParticleSystem = mcTrailParticleSystem; break;
				case EPSEffects.SpriteParticleSystemTemplate: mcCurrentParticleSystem = mcSpriteParticleSystemTemplate; break;
				case EPSEffects.Sprite3DBillboardParticleSystemTemplate: mcCurrentParticleSystem = mcSprite3DBillboardParticleSystemTemplate; break;
				case EPSEffects.QuadParticleSystemTemplate: mcCurrentParticleSystem = mcQuadParticleSystemTemplate; break;
				case EPSEffects.TexturedQuadParticleSystemTemplate: mcCurrentParticleSystem = mcTexturedQuadParticleSystemTemplate; break;
				case EPSEffects.DefaultSpriteParticleSystemTemplate: mcCurrentParticleSystem = mcDefaultSpriteParticleSystemTemplate; break;
				case EPSEffects.DefaultSprite3DBillboardParticleSystemTemplate: mcCurrentParticleSystem = mcDefaultSprite3DBillboardParticleSystemTemplate; break;
				case EPSEffects.DefaultQuadParticleSystemTemplate: mcCurrentParticleSystem = mcDefaultQuadParticleSystemTemplate; break;
				case EPSEffects.DefaultTexturedQuadParticleSystemTemplate: mcCurrentParticleSystem = mcDefaultTexturedQuadParticleSystemTemplate; break;
			}

			// Initialize the Particle System
			mcCurrentParticleSystem.AutoInitialize(this.GraphicsDevice, this.Content, null);

			// Do any necessary after initialization work
			switch (meCurrentPS)
			{
				default: break;
				case EPSEffects.ExplosionFireSmoke: mcExplosionFireSmokeParticleSystem.SetupToAutoExplodeEveryInterval(1); break;
				case EPSEffects.ExplosionFlash: mcExplosionFlashParticleSystem.SetupToAutoExplodeEveryInterval(1); break;
				case EPSEffects.ExplosionFlyingSparks: mcExplosionFlyingSparksParticleSystem.SetupToAutoExplodeEveryInterval(2); break;
				case EPSEffects.ExplosionSmokeTrails: mcExplosionSmokeTrailsParticleSystem.SetupToAutoExplodeEveryInterval(2); break;
				case EPSEffects.ExplosionRoundSparks: mcExplosionRoundSparksParticleSystem.SetupToAutoExplodeEveryInterval(2); break;
				case EPSEffects.ExplosionDebris: mcExplosionDebrisParticleSystem.SetupToAutoExplodeEveryInterval(2); break;
				case EPSEffects.ExplosionShockwave: mcExplosionShockwaveParticleSystem.SetupToAutoExplodeEveryInterval(2); break;
				case EPSEffects.Explosion: mcExplosionParticleSystem.SetupToAutoExplodeEveryInterval(2); break;
			}
		}
コード例 #4
0
		/// <summary>
		/// Handles the SplashScreenComplete event of the mcDPSFSplashScreenParticleSystem control.
		/// This gets called when the Splash Screen is done playing, so we can then load the regular code to start the demo.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
		void mcDPSFSplashScreenParticleSystem_SplashScreenComplete(object sender, EventArgs e)
		{
			// Now that the Splash Screen is done displaying, clean it up.
			mcDPSFSplashScreenParticleSystem.SplashScreenComplete -= new EventHandler(mcDPSFSplashScreenParticleSystem_SplashScreenComplete);
			mcParticleSystemManager.RemoveParticleSystem(mcDPSFSplashScreenParticleSystem);
			mcDPSFSplashScreenParticleSystem.Destroy();
			mcDPSFSplashScreenParticleSystem = null;

			// Reset some of the settings now that the Splash Screen is done.
			mbShowText = true;
			mbShowFloor = true;

			// Start displaying the demo's particle systems
			mcCurrentParticleSystem = null;
			InitializeCurrentParticleSystem();
		}
コード例 #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;
		}
コード例 #6
0
		/// <summary>
		/// Gets and processes all user input
		/// </summary>
		void ProcessInput(GameTime cGameTime)
		{
			// Save how long it's been since the last time Input was Handled
			float fTimeInSeconds = (float)cGameTime.ElapsedGameTime.TotalSeconds;

			// Add how long it's been since the last user input was received
			mcInputTimeSpan += TimeSpan.FromSeconds(fTimeInSeconds);

			// Save the Keyboard State and get its new State
			mcPreviousKeyboardState = mcCurrentKeyboardState;
			mcCurrentKeyboardState = Keyboard.GetState();

			// Save the Mouse State and get its new State
			mcPreviousMouseState = mcCurrentMouseState;
			mcCurrentMouseState = Mouse.GetState();

			// Save the GamePad State and get its new State
			mcPreviousGamePadState = mcCurrentGamePadState;
			mcCurrentGamePadState = GamePad.GetState(PlayerIndex.One);

			// If we should Exit
			if (KeyIsDown(Keys.Escape) || ButtonIsDown(Buttons.Back))
			{
				Exit();
			}

			// If we are currently showing the Splash Screen and a key was pressed, skip the Splash Screen.
			if (mcDPSFSplashScreenParticleSystem != null && 
				((mcCurrentKeyboardState.GetPressedKeys().Length > 0 && mcCurrentKeyboardState.GetPressedKeys()[0] != Keys.None) || 
				(mcCurrentMouseState.LeftButton == ButtonState.Pressed || mcCurrentMouseState.RightButton == ButtonState.Pressed) ||
				(mcCurrentGamePadState.IsButtonDown(Buttons.A | Buttons.B | Buttons.X | Buttons.Y | Buttons.Start))))
			{
				mcDPSFSplashScreenParticleSystem.IsSplashScreenComplete = true;
				return;
			}

			// If we should toggle showing the Floor
			if (KeyWasJustPressed(Keys.F))
			{
				mbShowFloor = !mbShowFloor;
			}

			// If we should toggle Pausing the game
			if (KeyWasJustPressed(Keys.Space) || ButtonWasJustPressed(Buttons.Start))
			{
				mbPaused = !mbPaused;
			}

			// If we should toggle between Full Screen and Windowed mode
			if (KeyWasJustPressed(Keys.End))
			{
				mcGraphics.ToggleFullScreen();
			}

			// If we should toggle showing the Common Controls
			if (KeyWasJustPressed(Keys.F1))
			{
				mbShowCommonControls = !mbShowCommonControls;
			}

			// If we should toggle showing the Particle System specific Controls
			if (KeyWasJustPressed(Keys.F2))
			{
				mbShowPSControls = !mbShowPSControls;
			}

			// If we should toggle showing the Camera Controls
			if (KeyWasJustPressed(Keys.F3))
			{
				mbShowCameraControls = !mbShowCameraControls;
			}

			// If we should toggle showing the Common Controls
			if (KeyWasJustPressed(Keys.F4))
			{
				mbShowText = !mbShowText;
			}

			// If we should toggle Clearing the Screen each Frame
			if (KeyWasJustPressed(Keys.F5))
			{
				mbClearScreenEveryFrame = !mbClearScreenEveryFrame;
				_clearScreenEveryFrameJustToggled = true;
			}
			
			// If the particle lifetimes should be drawn in one frame
			if (KeyWasJustPressed(Keys.F6))
			{
				mbDrawStaticPS = !mbDrawStaticPS;
				mbStaticParticlesDrawn = false;
			}

			// If the Axis should be toggled on/off
			if (KeyWasJustPressed(Keys.F7))
			{
				mbShowAxis = !mbShowAxis;
			}
#if (WINDOWS)
			// If the PS should be drawn to files
			if (KeyWasJustPressed(Keys.F8))
			{
				// Draw the Particle System Animation to a series of Image Files
				mcParticleSystemManager.DrawAllParticleSystemsAnimationToFiles(GraphicsDevice, miDrawPSToFilesImageWidth, miDrawPSToFilesImageHeight, 
							msDrawPSToFilesDirectoryName, mfDrawPSToFilesTotalTime, mfDrawPSToFilesTimeStep, mbCreateAnimatedGIF, mbCreateTileSetImage);
			}

			// If the PS should be serialized to a file
			if (KeyWasJustPressed(Keys.F9))
			{
				// Only particle systems that do not inherit the DrawableGameComponent can be serialized.
				if (!DPSFHelper.DPSFInheritsDrawableGameComponent)
				{
					// If we have the particle system right now
					if (mcCurrentParticleSystem != null)
					{
						// Serialize the particle system into a file
						System.IO.Stream stream = System.IO.File.Open("SerializedParticleSystem.dat", System.IO.FileMode.Create);
						System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
						formatter.Serialize(stream, mcCurrentParticleSystem);
						stream.Close();

						// Remove the particle system from the manager and destroy the particle system in memory
						mcParticleSystemManager.RemoveParticleSystem(mcCurrentParticleSystem);
						mcCurrentParticleSystem.Destroy();
						mcCurrentParticleSystem = null;
					}
					// Else we don't have the particle system right now
					else
					{
						// Deserialize the particle system from a file
						System.IO.Stream stream = System.IO.File.Open("SerializedParticleSystem.dat", System.IO.FileMode.Open);
						System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
						mcCurrentParticleSystem = (IDPSFParticleSystem)formatter.Deserialize(stream);
						stream.Close();

						try
						{
							// Setup the particle system properties that couldn't be serialized
							mcCurrentParticleSystem.InitializeNonSerializableProperties(this, this.GraphicsDevice, this.Content);
						}
						// Catch the case where the Particle System requires a texture, but one wasn't loaded
						catch (ArgumentNullException)
						{
							// Assign the particle system a texture to use
							mcCurrentParticleSystem.SetTexture("Textures/Bubble");
						}

						// Readd the particle system to the particle system manager
						mcParticleSystemManager.AddParticleSystem(mcCurrentParticleSystem);
					}
				}
			}
#endif
			// If the Performance Profiling was toggled
			if (KeyWasJustPressed(Keys.F10))
			{
				// Toggle if the Performance Profiling text should be drawn
				DrawPerformanceText = !DrawPerformanceText;
			}

			// Handle input for moving the Camera
			ProcessInputForCamera(fTimeInSeconds);

			// Handle input for controlling the Particle Systems
			ProcessInputForParticleSystem(fTimeInSeconds);
		}
コード例 #7
0
        public static void Remove(IDPSFParticleSystem system)
        {
            if(system == null)
                return;

            if(manager.ContainsParticleSystem(system))
            {
                system.RemoveAllParticles();
                manager.RemoveParticleSystem(system);
            }
        }
コード例 #8
0
        public static void Add(IDPSFParticleSystem system)
        {
            if(system == null)
            {
                Cutter.WriteToLog(d, "Warning: Add(system) was called with a null parameter. Ensure this is correct behavior.");
                return;
            }

            if(!manager.ContainsParticleSystem(system))
            {
                manager.AddParticleSystem(system);
            }
        }