/// <summary> /// Constructor. /// </summary> public Particle3DSampleGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Construct our particle system components. explosionParticles = new ExplosionParticleSystem(this, Content); explosionSmokeParticles = new ExplosionSmokeParticleSystem(this, Content); projectileTrailParticles = new ProjectileTrailParticleSystem(this, Content); smokePlumeParticles = new SmokePlumeParticleSystem(this, Content); fireParticles = new FireParticleSystem(this, Content); // Set the draw order so the explosions and fire // will appear over the top of the smoke. smokePlumeParticles.DrawOrder = 100; explosionSmokeParticles.DrawOrder = 200; projectileTrailParticles.DrawOrder = 300; explosionParticles.DrawOrder = 400; fireParticles.DrawOrder = 500; // Register the particle system components. Components.Add(explosionParticles); Components.Add(explosionSmokeParticles); Components.Add(projectileTrailParticles); Components.Add(smokePlumeParticles); Components.Add(fireParticles); }
/// <summary> /// Constructor. /// </summary> public Particle3DSampleGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.PreferredBackBufferWidth = 853; graphics.PreferredBackBufferHeight = 480; graphics.MinimumPixelShaderProfile = ShaderProfile.PS_2_0; // Construct our particle system components. explosionParticles = new ParticleSystem(this, Content, "ExplosionSettings"); explosionSmokeParticles = new ParticleSystem(this, Content, "ExplosionSmokeSettings"); projectileTrailParticles = new ParticleSystem(this, Content, "ProjectileTrailSettings"); smokePlumeParticles = new ParticleSystem(this, Content, "SmokePlumeSettings"); fireParticles = new ParticleSystem(this, Content, "FireSettings"); // Set the draw order so the explosions and fire // will appear over the top of the smoke. smokePlumeParticles.DrawOrder = 100; explosionSmokeParticles.DrawOrder = 200; projectileTrailParticles.DrawOrder = 300; explosionParticles.DrawOrder = 400; fireParticles.DrawOrder = 500; // Register the particle system components. Components.Add(explosionParticles); Components.Add(explosionSmokeParticles); Components.Add(projectileTrailParticles); Components.Add(smokePlumeParticles); Components.Add(fireParticles); }
/// <summary> /// Constructs a new particle emitter object. /// </summary> public ParticleEmitter(ParticleSystem particleSystem, float particlesPerSecond, Vector3 initialPosition) { this.particleSystem = particleSystem; timeBetweenParticles = 1.0f / particlesPerSecond; previousPosition = initialPosition; }
/// <summary> /// Constructor. /// </summary> public Particle3DSampleGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Construct our particle system components. explosionParticles = new ExplosionParticleSystem(this, Content); explosionSmokeParticles = new ExplosionSmokeParticleSystem(this, Content); projectileTrailParticles = new ProjectileTrailParticleSystem(this, Content); smokePlumeParticles = new GenericParticleSystem(this, Content); fireParticles = new FireParticleSystem(this, Content); fireStreamParticles = new FirestreamParticleSystem(this, Content); smokePlumeParticles.InitializeSettings(new ParticleSettings("Test.xml")); // Register the particle system components. }
/// <summary> /// Constructs a new projectile. /// </summary> public Projectile(ParticleSystem explosionParticles, ParticleSystem explosionSmokeParticles, ParticleSystem projectileTrailParticles) { this.explosionParticles = explosionParticles; this.explosionSmokeParticles = explosionSmokeParticles; // Start at the origin, firing in a random (but roughly upward) direction. position = Vector3.Zero; velocity.X = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange; velocity.Y = (float)(random.NextDouble() + 0.5) * verticalVelocityRange; velocity.Z = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange; // Use the particle emitter helper to output our trail particles. trailEmitter = new ParticleEmitter(projectileTrailParticles, trailParticlesPerSecond, position); }
/// <summary> /// Constructs a new projectile. /// </summary> public Projectile(ParticleSystem explosionParticles, ParticleSystem explosionSmokeParticles, ParticleSystem projectileTrailParticles, Vector3 startPosition) { this.explosionParticles = explosionParticles; this.explosionSmokeParticles = explosionSmokeParticles; // Start at the origin, firing in a random (but roughly upward) direction. position = startPosition;//new Vector3((0-startPosition.X/2)/4, ((-startPosition.Y)/2)/4, 0);//Vector3.Zero; velocity = new Vector3(); velocity.X = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange; velocity.Y = (float)(random.NextDouble() + 0.5) * verticalVelocityRange+40; velocity.Z = 0;// (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange; projectileLifespan = (float)random.NextDouble() * (projectileMaxLifespan - projectileMinLifespan) + projectileMinLifespan; // Use the particle emitter helper to output our trail particles. trailEmitter = new ParticleEmitter(projectileTrailParticles, trailParticlesPerSecond, position); age = 0; }
public ParticleManager() { explosionParticles = new ExplosionParticleSystem(GameState.Get().Game, GameState.Get().Game.Content); explosionSmokeParticles = new ExplosionSmokeParticleSystem(GameState.Get().Game, GameState.Get().Game.Content); projectileTrailParticles = new ProjectileTrailParticleSystem(GameState.Get().Game, GameState.Get().Game.Content); smokePlumeParticles = new SmokePlumeParticleSystem(GameState.Get().Game, GameState.Get().Game.Content); fireParticles = new FireParticleSystem(GameState.Get().Game, GameState.Get().Game.Content); shipSmokeParticles = new ShipSmokeParticleSystem(GameState.Get().Game, GameState.Get().Game.Content); smokePlumeParticles.DrawOrder = 100; explosionSmokeParticles.DrawOrder = 200; projectileTrailParticles.DrawOrder = 300; explosionParticles.DrawOrder = 400; fireParticles.DrawOrder = 500; shipSmokeParticles.DrawOrder = 100; GameState.Get().Game.Components.Add(explosionParticles); GameState.Get().Game.Components.Add(explosionSmokeParticles); GameState.Get().Game.Components.Add(projectileTrailParticles); GameState.Get().Game.Components.Add(smokePlumeParticles); GameState.Get().Game.Components.Add(fireParticles); GameState.Get().Game.Components.Add(shipSmokeParticles); }
private void DoParticleLoad() { this.beamflashes = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/BeamFlash", this.ScreenManager.GraphicsDevice); this.beamflashes.LoadContent(); this.explosionParticles = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/ExplosionSettings", this.ScreenManager.GraphicsDevice); this.explosionParticles.LoadContent(); this.photonExplosionParticles = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/PhotonExplosionSettings", this.ScreenManager.GraphicsDevice); this.photonExplosionParticles.LoadContent(); this.explosionSmokeParticles = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/ExplosionSmokeSettings", this.ScreenManager.GraphicsDevice); this.explosionSmokeParticles.LoadContent(); this.projectileTrailParticles = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/ProjectileTrailSettings", this.ScreenManager.GraphicsDevice); this.projectileTrailParticles.LoadContent(); this.fireTrailParticles = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/FireTrailSettings", this.ScreenManager.GraphicsDevice); this.fireTrailParticles.LoadContent(); this.smokePlumeParticles = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/SmokePlumeSettings", this.ScreenManager.GraphicsDevice); this.smokePlumeParticles.LoadContent(); this.fireParticles = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/FireSettings", this.ScreenManager.GraphicsDevice); this.fireParticles.LoadContent(); this.engineTrailParticles = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/EngineTrailSettings", this.ScreenManager.GraphicsDevice); this.engineTrailParticles.LoadContent(); this.flameParticles = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/FlameSettings", this.ScreenManager.GraphicsDevice); this.flameParticles.LoadContent(); this.sparks = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/sparks", this.ScreenManager.GraphicsDevice); this.sparks.LoadContent(); this.lightning = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/lightning", this.ScreenManager.GraphicsDevice); this.lightning.LoadContent(); this.flash = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/FlashSettings", this.ScreenManager.GraphicsDevice); this.flash.LoadContent(); this.star_particles = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/star_particles", this.ScreenManager.GraphicsDevice); this.star_particles.LoadContent(); this.neb_particles = new ParticleSystem((Game)Game1.Instance, this.ScreenManager.Content, "3DParticles/GalaxyParticle", this.ScreenManager.GraphicsDevice); this.neb_particles.LoadContent(); }
protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.starfield != null) this.starfield.Dispose(); if (this.DeepSpaceDone != null) this.DeepSpaceDone.Dispose(); if (this.EmpireDone != null) this.EmpireDone.Dispose(); if (this.DeepSpaceGateKeeper != null) this.DeepSpaceGateKeeper.Dispose(); if (this.ItemsToBuild != null) this.ItemsToBuild.Dispose(); if (this.WorkerBeginEvent != null) this.WorkerBeginEvent.Dispose(); if (this.WorkerCompletedEvent != null) this.WorkerCompletedEvent.Dispose(); if (this.anomalyManager != null) this.anomalyManager.Dispose(); if (this.bloomComponent != null) this.bloomComponent.Dispose(); if (this.ShipGateKeeper != null) this.ShipGateKeeper.Dispose(); if (this.SystemThreadGateKeeper != null) this.SystemThreadGateKeeper.Dispose(); if (this.FogMap != null) this.FogMap.Dispose(); if (this.MasterShipList != null) this.MasterShipList.Dispose(); if (this.EmpireGateKeeper != null) this.EmpireGateKeeper.Dispose(); if (this.BombList != null) this.BombList.Dispose(); if (this.flash != null) this.flash.Dispose(); if (this.lightning != null) this.lightning.Dispose(); if (this.neb_particles != null) this.neb_particles.Dispose(); if (this.photonExplosionParticles != null) this.photonExplosionParticles.Dispose(); if (this.projectileTrailParticles != null) this.projectileTrailParticles.Dispose(); if (this.sceneMap != null) this.sceneMap.Dispose(); if (this.shipListInfoUI != null) this.shipListInfoUI.Dispose(); if (this.smokePlumeParticles != null) this.smokePlumeParticles.Dispose(); if (this.sparks != null) this.sparks.Dispose(); if (this.star_particles != null) this.star_particles.Dispose(); if (this.engineTrailParticles != null) this.engineTrailParticles.Dispose(); if (this.explosionParticles != null) this.explosionParticles.Dispose(); if (this.explosionSmokeParticles != null) this.explosionSmokeParticles.Dispose(); if (this.fireTrailParticles != null) this.fireTrailParticles.Dispose(); if (this.fireParticles != null) this.fireParticles.Dispose(); if (this.flameParticles != null) this.flameParticles.Dispose(); if (this.beamflashes != null) this.beamflashes.Dispose(); if (this.dsbw != null) this.dsbw.Dispose(); if (this.SelectedShipList != null) this.SelectedShipList.Dispose(); if (this.NotificationManager != null) this.NotificationManager.Dispose(); if (this.FogMapTarget != null) this.FogMapTarget.Dispose(); } this.starfield = null; this.DeepSpaceDone = null; this.EmpireDone = null; this.DeepSpaceGateKeeper = null; this.ItemsToBuild = null; this.WorkerBeginEvent = null; this.WorkerCompletedEvent = null; this.anomalyManager = null; this.bloomComponent = null; this.ShipGateKeeper = null; this.SystemThreadGateKeeper = null; this.FogMap = null; this.MasterShipList = null; this.EmpireGateKeeper = null; this.BombList = null; this.flash = null; this.lightning = null; this.neb_particles = null; this.photonExplosionParticles = null; this.projectileTrailParticles = null; this.sceneMap = null; this.shipListInfoUI = null; this.smokePlumeParticles = null; this.sparks = null; this.star_particles = null; this.engineTrailParticles = null; this.explosionParticles = null; this.explosionSmokeParticles = null; this.fireTrailParticles = null; this.fireParticles = null; this.flameParticles = null; this.beamflashes = null; this.dsbw = null; this.SelectedShipList = null; this.NotificationManager = null; this.FogMapTarget = null; } }
protected override void LoadContent() { viewMatrix = Matrix.CreateLookAt(new Vector3(0, 0, -200), new Vector3(0, 0, 0), new Vector3(0, 1, 0)); projectionMatrix = Matrix.CreateOrthographic(GraphicsDevice.Viewport.Width / 5, GraphicsDevice.Viewport.Height / 5, -5000, 5000); explosionParticles = new ExplosionParticleSystem(this.Game, Shorewood.Content); projectileTrailParticles = new ProjectileTrailParticleSystem(this.Game, Shorewood.Content); explosionSmokeParticles = new ExplosionSmokeParticleSystem(this.Game, Shorewood.Content); projectileTrailParticles.DrawOrder = 300; explosionParticles.DrawOrder = 400; explosionSmokeParticles.DrawOrder = 100; explosionParticles.Initialize(); projectileTrailParticles.Initialize(); explosionSmokeParticles.Initialize(); projectileTrailParticles.SelfLoad(); explosionParticles.SelfLoad(); explosionSmokeParticles.SelfLoad(); explosionParticles.SetCamera(viewMatrix, projectionMatrix); projectileTrailParticles.SetCamera(viewMatrix, projectionMatrix); explosionSmokeParticles.SetCamera(viewMatrix, projectionMatrix); base.LoadContent(); }
/// <summary> /// Handles input for quitting the game and cycling /// through the different particle effects. /// </summary> void HandleInput() { lastKeyboardState = currentKeyboardState; lastGamePadState = currentGamePadState; currentKeyboardState = Keyboard.GetState(); currentGamePadState = GamePad.GetState(PlayerIndex.One); // Check for exit. if (currentKeyboardState.IsKeyDown(Keys.Escape) || currentGamePadState.Buttons.Back == ButtonState.Pressed) { Exit(); } /* Check for particle effect reload */ if (currentKeyboardState.IsKeyUp(Keys.H) && lastKeyboardState.IsKeyDown(Keys.H)) { /* Hacky Reload Incoming! */ lock (effectLock) { //we'll just do everything that we do when making a particle effect up // smokePlumeParticles = new GenericParticleSystem(this, Content); smokePlumeParticles.Initialize("Test.xml"); smokePlumeParticles.LoadContent(); } } }