public void LoadEvents() { // Specify the particle initialization function ParticleInitializationFunction = InitializeParticleShockwave; // Setup the behaviors that the particles should have ParticleEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticleWidthAndHeightUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyWithQuickFadeInAndSlowFadeOut, 100); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToBeMoreTransparent, 101); // Setup the emitter Emitter.PositionData.Position = new Vector3(0, 25, 0); Emitter.ParticlesPerSecond = 10000; Emitter.EmitParticlesAutomatically = false; // We will call the Explode() function to release a burst of particles instead of always emitting them // Set the default explosion settings ShockwaveColor = new Color(255, 120, 0); ShockwaveSize = 300; ShockwaveDuration = 0.5f; ShockwaveTransparency = 0.25f; ShockwaveXAxisEnabled = true; ShockwaveYAxisEnabled = true; ShockwaveZAxisEnabled = true; ShockwaveXYAxisEnabled = true; ShockwaveXZAxisEnabled = true; ShockwaveYZAxisEnabled = true; ShockwaveXYNegativeAxisEnabled = true; ShockwaveXZNegativeAxisEnabled = true; ShockwaveYZNegativeAxisEnabled = true; }
/// <summary> /// Load the Particle System Events and any other settings /// </summary> public void LoadParticleSystem() { //----------------------------------------------------------- // TODO: Setup the Particle System to achieve the desired result. // You may change all of the code in this function. It is just // provided to show you how to setup a simple particle system. //----------------------------------------------------------- // Set the Function to use to Initialize new Particles ParticleInitializationFunction = InitializeParticleProperties; // Remove all Events first so that none are added twice if this function is called again ParticleEvents.RemoveAllEvents(); ParticleSystemEvents.RemoveAllEvents(); // Make the Particles move according to their Velocity ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity); // Set the Particle System's Emitter to toggle on and off every 0.5 seconds ParticleSystemEvents.LifetimeData.EndOfLifeOption = CParticleSystemEvents.EParticleSystemEndOfLifeOptions.Repeat; ParticleSystemEvents.LifetimeData.Lifetime = 1.0f; ParticleSystemEvents.AddTimedEvent(0.0f, UpdateParticleSystemEmitParticlesAutomaticallyOn); ParticleSystemEvents.AddTimedEvent(0.5f, UpdateParticleSystemEmitParticlesAutomaticallyOff); // Setup the Emitter so Particles come from the bottom center of the screen Emitter.ParticlesPerSecond = 25; Emitter.PositionData.Position = new Vector3((GraphicsDevice.Viewport.Width / 2) - (mfSizeMax / 2), GraphicsDevice.Viewport.Height - mfSizeMax, 0); }
/// <summary> /// Load the Particle System Events and any other settings /// </summary> public void LoadParticleSystem() { //----------------------------------------------------------- // TODO: Setup the Particle System to achieve the desired result. // You may change all of the code in this function. It is just // provided to show you how to setup a simple particle system. //----------------------------------------------------------- // Set the Function to use to Initialize new Particles ParticleInitializationFunction = InitializeParticleProperties; // Remove all Events first so that none are added twice if this function is called again ParticleEvents.RemoveAllEvents(); ParticleSystemEvents.RemoveAllEvents(); // Make the Particles move according to their Velocity, and orient them to face the Camera ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleToFaceTheCamera, 1000); // Set the Particle System's Emitter to toggle on and off every 0.5 seconds //ParticleSystemEvents.LifetimeData.EndOfLifeOption = CParticleSystemEvents.EParticleSystemEndOfLifeOptions.Repeat; //ParticleSystemEvents.LifetimeData.Lifetime = 1.0f; //ParticleSystemEvents.AddTimedEvent(0.0f, UpdateParticleSystemEmitParticlesAutomaticallyOn); //ParticleSystemEvents.AddTimedEvent(0.5f, UpdateParticleSystemEmitParticlesAutomaticallyOff); // Setup the Emitter Emitter.EmitParticlesAutomatically = false; Emitter.ParticlesPerSecond = 100; Emitter.PositionData.Position = new Vector3(0, 0, 0); addIndiParticle(false); addIndiParticle(true); }
public void LoadSnowEvents() { ParticleInitializationFunction = InitializeParticleSnow; ParticleEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingExternalForce, 100); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionAndVelocityUsingAcceleration, 500); ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationUsingRotationalVelocity, 500); ParticleEvents.AddEveryTimeEvent(UpdateParticleDieOnceGroundIsHit, 1000); ParticleEvents.AddEveryTimeEvent(UpdateParticleChangeVelocityAndRotation); }
public void LoadSmokeEvents() { ParticleInitializationFunction = InitializeParticleRisingSmoke; ParticleEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionAndVelocityUsingAcceleration, 500); ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationUsingRotationalVelocity); ParticleEvents.AddEveryTimeEvent(UpdateColor); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyWithQuickFadeInAndSlowFadeOut, 100); ParticleEvents.AddEveryTimeEvent(IncreaseSizeBasedOnLifetime); }
public void LoadCloudEvents() { Name = "Sprite Cloud"; SetTexture("Textures/Smoke"); RemoveAllParticles(); MaxNumberOfParticlesAllowed = 1000; ParticleInitializationFunction = InitializeParticleUsingInitialProperties; ParticleEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionAndVelocityUsingAcceleration, 500); ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationAndRotationalVelocityUsingRotationalAcceleration); ParticleEvents.AddEveryTimeEvent(UpdateParticleWidthAndHeightUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleColorUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeOutUsingLerp, 100); Emitter.PositionData.Position = new Vector3(miScreenWidth / 2, miScreenHeight / 2, 0); AttractorMode = EAttractorModes.None; msAttractorPosition = new Vector3(miScreenWidth / 2, miScreenHeight / 2, 0); mfAttractorAffectDistance = 300; InitialProperties.LifetimeMin = 3.0f; InitialProperties.LifetimeMax = 3.0f; InitialProperties.PositionMin = Vector3.Zero; InitialProperties.PositionMax = Vector3.Zero; InitialProperties.VelocityMin = new Vector3(-50, -50, -50); InitialProperties.VelocityMax = new Vector3(50, 50, 50); InitialProperties.AccelerationMin = Vector3.Zero; InitialProperties.AccelerationMax = Vector3.Zero; InitialProperties.StartColorMin = Color.Red; InitialProperties.StartColorMax = Color.White; InitialProperties.EndColorMin = Color.Blue; InitialProperties.EndColorMax = Color.White; InitialProperties.InterpolateBetweenMinAndMaxColors = false; InitialProperties.StartWidthMin = 10.0f; InitialProperties.StartWidthMax = 30.0f; InitialProperties.StartHeightMin = InitialProperties.StartWidthMin; InitialProperties.StartHeightMax = InitialProperties.StartWidthMax; InitialProperties.EndWidthMin = 50.0f; InitialProperties.EndWidthMax = 70.0f; InitialProperties.EndHeightMin = InitialProperties.EndWidthMin; InitialProperties.EndHeightMax = InitialProperties.EndWidthMax; InitialProperties.RotationMin = 0.0f; InitialProperties.RotationMax = MathHelper.Pi; InitialProperties.RotationalVelocityMin = -MathHelper.Pi; InitialProperties.RotationalVelocityMax = MathHelper.Pi; InitialProperties.RotationalAccelerationMin = -MathHelper.PiOver2; InitialProperties.RotationalAccelerationMax = MathHelper.PiOver2; InitialProperties.FrictionMin = mfGravity; InitialProperties.FrictionMax = mfGravity; }
public void LoadGridEvents() { Name = "Sprite Grid"; SetTexture("Textures/WhiteSquare"); RemoveAllParticles(); miRows = 20; miColumns = 20; MaxNumberOfParticlesAllowed = miRows + miColumns; ParticleInitializationFunction = InitializeParticleGrid; ParticleEvents.RemoveAllEvents(); }
public void LoadRotatorsEvents() { Name = "Sprite Rotators"; SetTexture("Textures/Bubble"); RemoveAllParticles(); miRows = 3; miColumns = 3; MaxNumberOfParticlesAllowed = miRows * miColumns; ParticleInitializationFunction = InitializeParticleRotators; ParticleEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticleRotateParticleAroundPivotPoint); }
public override void LoadParticleSystem() { ParticleInitializationFunction = InitializeParticleUsingInitialProperties; InitialProperties.LifetimeMin = .2f; InitialProperties.LifetimeMax = .6f; InitialProperties.PositionMin = Vector3.Zero; InitialProperties.PositionMax = Vector3.Zero; InitialProperties.VelocityMin = direction * new Vector3(power * 20, -power * 20, 0); InitialProperties.VelocityMax = direction * new Vector3(power * 100, -power * 100, 0); InitialProperties.RotationMin = (float)-Math.PI; InitialProperties.RotationMax = (float)Math.PI; InitialProperties.RotationalVelocityMin = 0; InitialProperties.RotationalVelocityMax = 0; InitialProperties.StartWidthMin = 5; InitialProperties.StartWidthMax = 10; InitialProperties.StartHeightMin = 5; InitialProperties.StartHeightMax = 10; InitialProperties.EndWidthMin = 30; InitialProperties.EndWidthMax = 40; InitialProperties.EndHeightMin = 30; InitialProperties.EndHeightMax = 40; InitialProperties.StartColorMin = Color.Gray; InitialProperties.StartColorMax = Color.Gray; InitialProperties.EndColorMin = Color.White; InitialProperties.EndColorMax = Color.White; InitialProperties.FrictionMin = 100; InitialProperties.FrictionMax = 200; ParticleEvents.RemoveAllEvents(); ParticleSystemEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationUsingRotationalVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleWidthAndHeightUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleColorUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeInUsingLerp, 100); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeOutUsingLerp, 100); ParticleEvents.AddEveryTimeEvent(UpdateParticleVelocityUsingFriction, 100); ParticleSystemEvents.LifetimeData.EndOfLifeOption = CParticleSystemEvents.EParticleSystemEndOfLifeOptions.Destroy; ParticleSystemEvents.LifetimeData.Lifetime = .6f; ParticleSystemEvents.AddTimedEvent(0.0f, UpdateParticleSystemEmitParticlesAutomaticallyOn); ParticleSystemEvents.AddTimedEvent(0.1f, UpdateParticleSystemEmitParticlesAutomaticallyOff); Emitter.ParticlesPerSecond = 100; Emitter.PositionData.Position = position; }
public override void LoadParticleSystem() { ParticleInitializationFunction = InitializeParticleUsingInitialProperties; InitialProperties.LifetimeMin = .4f; InitialProperties.LifetimeMax = 1.0f; InitialProperties.PositionMin = new Vector3(-20, 0, 0); InitialProperties.PositionMax = new Vector3(20, 20, 0); InitialProperties.VelocityMin = new Vector3(0, -20, 0); InitialProperties.VelocityMax = new Vector3(0, -60, 0); InitialProperties.RotationMin = (float)-Math.PI / 8; InitialProperties.RotationMax = (float)Math.PI / 8; InitialProperties.RotationalVelocityMin = 0; InitialProperties.RotationalVelocityMax = 0; InitialProperties.StartWidthMin = 0; InitialProperties.StartWidthMax = 10; InitialProperties.StartHeightMin = 0; InitialProperties.StartHeightMax = 10; InitialProperties.EndWidthMin = 30; InitialProperties.EndWidthMax = 40; InitialProperties.EndHeightMin = 20; InitialProperties.EndHeightMax = 40; InitialProperties.StartColorMin = cloudColor; InitialProperties.StartColorMax = cloudColor; InitialProperties.EndColorMin = cloudColor; InitialProperties.EndColorMax = cloudColor; ParticleEvents.RemoveAllEvents(); ParticleSystemEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationUsingRotationalVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleWidthAndHeightUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleColorUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeInUsingLerp, 100); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeOutUsingLerp, 100); ParticleSystemEvents.LifetimeData.EndOfLifeOption = CParticleSystemEvents.EParticleSystemEndOfLifeOptions.Repeat; ParticleSystemEvents.LifetimeData.Lifetime = 1.0f; ParticleSystemEvents.AddTimedEvent(0.0f, UpdateParticleSystemEmitParticlesAutomaticallyOn); ParticleSystemEvents.AddTimedEvent(0.6f, UpdateParticleSystemEmitParticlesAutomaticallyOff); Emitter.ParticlesPerSecond = particlesPerSecond; Emitter.PositionData.Position = position; }
public override void LoadParticleSystem() { ParticleInitializationFunction = InitializeParticleUsingInitialProperties; InitialProperties.LifetimeMin = .1f; InitialProperties.LifetimeMax = .3f; InitialProperties.PositionMin = new Vector3(0, 0, 0); InitialProperties.PositionMax = new Vector3(0, 0, 0); InitialProperties.VelocityMin = direction * new Vector3(-200, -100, 0); InitialProperties.VelocityMax = direction * new Vector3(-50, -10, 0); InitialProperties.RotationMin = -MathHelper.Pi; InitialProperties.RotationMax = MathHelper.Pi; InitialProperties.RotationalVelocityMin = -MathHelper.Pi; InitialProperties.RotationalVelocityMax = MathHelper.Pi; InitialProperties.StartWidthMin = 5; InitialProperties.StartWidthMax = 5; InitialProperties.StartHeightMin = 5; InitialProperties.StartHeightMax = 5; InitialProperties.EndWidthMin = 5; InitialProperties.EndWidthMax = 5; InitialProperties.EndHeightMin = 5; InitialProperties.EndHeightMax = 5; InitialProperties.StartColorMin = Color.White; InitialProperties.StartColorMax = Color.White; InitialProperties.EndColorMin = Color.White; InitialProperties.EndColorMax = Color.White; ParticleEvents.RemoveAllEvents(); ParticleSystemEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationUsingRotationalVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleWidthAndHeightUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleColorUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeOutUsingLerp, 100); ParticleSystemEvents.LifetimeData.EndOfLifeOption = CParticleSystemEvents.EParticleSystemEndOfLifeOptions.Destroy; ParticleSystemEvents.LifetimeData.Lifetime = .4f; ParticleSystemEvents.AddTimedEvent(0.0f, UpdateParticleSystemEmitParticlesAutomaticallyOn); ParticleSystemEvents.AddTimedEvent(0.1f, UpdateParticleSystemEmitParticlesAutomaticallyOff); Emitter.ParticlesPerSecond = 2000; Emitter.PositionData.Position = position; }
public override void LoadParticleSystem() { ParticleInitializationFunction = InitializeParticleUsingInitialProperties; InitialProperties.LifetimeMin = 1.0f; InitialProperties.LifetimeMax = 10.0f; InitialProperties.PositionMin = Vector3.Zero; InitialProperties.PositionMax = Vector3.Zero; InitialProperties.VelocityMin = Vector3.Zero; InitialProperties.VelocityMax = Vector3.Zero; InitialProperties.RotationMin = 0.0f; InitialProperties.RotationMax = 0.0f; InitialProperties.RotationalVelocityMin = rotationSpeed; InitialProperties.RotationalVelocityMax = rotationSpeed; InitialProperties.StartWidthMin = 250; InitialProperties.StartWidthMax = 250; InitialProperties.StartHeightMin = 250; InitialProperties.StartHeightMax = 250; InitialProperties.EndWidthMin = 250; InitialProperties.EndWidthMax = 250; InitialProperties.EndHeightMin = 250; InitialProperties.EndHeightMax = 250; InitialProperties.StartColorMin = Color.White; InitialProperties.StartColorMax = Color.White; InitialProperties.EndColorMin = Color.White; InitialProperties.EndColorMax = Color.White; ParticleEvents.RemoveAllEvents(); ParticleSystemEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationUsingRotationalVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleWidthAndHeightUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleColorUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeOutUsingLerp, 100); ParticleSystemEvents.LifetimeData.EndOfLifeOption = CParticleSystemEvents.EParticleSystemEndOfLifeOptions.Destroy; ParticleSystemEvents.LifetimeData.Lifetime = 1.0f; ParticleSystemEvents.AddTimedEvent(0.0f, UpdateParticleSystemEmitParticlesAutomaticallyOn); ParticleSystemEvents.AddTimedEvent(1.0f, UpdateParticleSystemEmitParticlesAutomaticallyOff); Emitter.ParticlesPerSecond = 100; Emitter.PositionData.Position = position; }
public override void LoadParticleSystem() { ParticleInitializationFunction = InitializeParticleUsingInitialProperties; InitialProperties.LifetimeMin = 1; InitialProperties.LifetimeMax = 20; InitialProperties.PositionMin = Vector3.Zero; InitialProperties.PositionMax = Vector3.Zero; InitialProperties.VelocityMin = new Vector3(-20, 20, 0); InitialProperties.VelocityMax = new Vector3(20, 100, 0); InitialProperties.RotationMin = 0.0f; InitialProperties.RotationMax = 0.0f; InitialProperties.RotationalVelocityMin = -MathHelper.Pi; InitialProperties.RotationalVelocityMax = MathHelper.Pi; InitialProperties.StartWidthMin = 5; InitialProperties.StartWidthMax = 20; InitialProperties.StartHeightMin = 5; InitialProperties.StartHeightMax = 20; InitialProperties.EndWidthMin = 0; InitialProperties.EndWidthMax = 10; InitialProperties.EndHeightMin = 0; InitialProperties.EndHeightMax = 10; InitialProperties.StartColorMin = Color.Black; InitialProperties.StartColorMax = Color.White; InitialProperties.EndColorMin = Color.Black; InitialProperties.EndColorMax = Color.White; ParticleEvents.RemoveAllEvents(); ParticleSystemEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationUsingRotationalVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleWidthAndHeightUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleColorUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeOutUsingLerp, 100); ParticleSystemEvents.LifetimeData.EndOfLifeOption = CParticleSystemEvents.EParticleSystemEndOfLifeOptions.Destroy; ParticleSystemEvents.LifetimeData.Lifetime = 20; ParticleSystemEvents.AddTimedEvent(0.0f, UpdateParticleSystemEmitParticlesAutomaticallyOn); ParticleSystemEvents.AddTimedEvent(.6f, UpdateParticleSystemEmitParticlesAutomaticallyOff); Emitter.ParticlesPerSecond = DPSFHelper.RandomNumberBetween(100, 2000); Emitter.PositionData.Position = position; }
public void LoadLargeExplosion() { // Specify the particle initialization function ParticleInitializationFunction = InitializeParticleExplosion; // Setup the behaviors that the particles should have ParticleEvents.RemoveAllEvents(); // Setup the emitter Emitter.PositionData.Position = new Vector3(0, 25, 0); Emitter.ParticlesPerSecond = 10000; Emitter.EmitParticlesAutomatically = false; // We will call the Explode() function to release a burst of particles instead of always emitting them // Set the default explosion settings ExplosionColor = new Color(255, 120, 0); ExplosionParticleSize = 10; ExplosionIntensity = 20; }
public void LoadAttractionEvents() { Name = "Sprite Force"; SetTexture("Textures/Particle"); RemoveAllParticles(); MaxNumberOfParticlesAllowed = 1500; ParticleInitializationFunction = InitializeParticleAttraction; ParticleEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticleVelocityUsingExternalForce, 100); ParticleEvents.AddEveryTimeEvent(UpdateParticleVelocityUsingFriction, 200); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionAndVelocityUsingAcceleration, 500); ParticleEvents.AddEveryTimeEvent(UpdateParticleKeepParticleOnScreen, 1000); AttractorMode = EAttractorModes.Attract; mfAttractorAffectDistance = 200; }
public void LoadEvents() { // Specify the particle initialization function ParticleInitializationFunction = InitializeParticleExplosion; // Setup the behaviours that the particles should have ParticleEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyWithQuickFadeInAndSlowFadeOut, 100); ParticleEvents.AddEveryTimeEvent(UpdateParticleFlashSize); // Setup the emitter Emitter.PositionData.Position = new Vector3(0, 50, 0); Emitter.ParticlesPerSecond = 10000; Emitter.EmitParticlesAutomatically = false; // We will call the Explode() function to release a burst of particles instead of always emitting them // Set the default explosion settings ExplosionColor = new Color(255, 120, 0); ExplosionParticleSize = 70; ExplosionIntensity = 5; }
public override void LoadParticleSystem() { ParticleInitializationFunction = InitializeParticleProperties; ParticleEvents.RemoveAllEvents(); ParticleSystemEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationUsingRotationalVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleColorUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeOutUsingLerp, 100); ParticleSystemEvents.LifetimeData.EndOfLifeOption = CParticleSystemEvents.EParticleSystemEndOfLifeOptions.Destroy; ParticleSystemEvents.LifetimeData.Lifetime = DPSFHelper.RandomNumberBetween(0.5f, 2.0f); ParticleSystemEvents.AddTimedEvent(0.0f, UpdateParticleSystemEmitParticlesAutomaticallyOn); ParticleSystemEvents.AddTimedEvent(.2f, UpdateParticleSystemEmitParticlesAutomaticallyOff); Emitter.ParticlesPerSecond = DPSFHelper.RandomNumberBetween(100, 2000); Emitter.PositionData.Position = position; }
public override void LoadParticleSystem() { ParticleInitializationFunction = InitializeParticleProperties; ParticleEvents.RemoveAllEvents(); ParticleSystemEvents.RemoveAllEvents(); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationUsingRotationalVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleColorUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeOutUsingLerp, 100); ParticleEvents.AddEveryTimeEvent(UpdateParticleVelocityUsingFriction); ParticleSystemEvents.LifetimeData.EndOfLifeOption = CParticleSystemEvents.EParticleSystemEndOfLifeOptions.Repeat; ParticleSystemEvents.LifetimeData.Lifetime = lifeTime; ParticleSystemEvents.AddTimedEvent(0.0f, UpdateParticleSystemEmitParticlesAutomaticallyOn); ParticleSystemEvents.AddTimedEvent(.1f, UpdateParticleSystemEmitParticlesAutomaticallyOff); Emitter.ParticlesPerSecond = 9999; Emitter.PositionData.Position = position; }
/// <summary> /// Load the Particle System Events and any other settings. /// </summary> public void LoadParticleSystem() { // Set the Particle Initialization Function, as it can be changed on the fly // and we want to make sure we are using the right one to start with to start with. ParticleInitializationFunction = InitializeParticleProperties; // Remove all Events first so that none are added twice if this function is called again ParticleEvents.RemoveAllEvents(); ParticleSystemEvents.RemoveAllEvents(); // Setup the Emitter Emitter.ParticlesPerSecond = 100; //Emitter.PositionData.Position = new Vector3(-100, 50, 0); // Allow the Particle's Velocity, Rotational Velocity, Color, and Transparency to be updated each frame ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity); // This function must be executed after the Color Lerp function as the Color Lerp will overwrite the Color's // Transparency value, so we give this function an Execution Order of 100 to make sure it is executed last. ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeOutUsingLerp, 100); // Update the particle to face the camera. Do this after updating it's rotation/orientation. ParticleEvents.AddEveryTimeEvent(UpdateParticleToFaceTheCamera, 200); ParticleEvents.AddEveryTimeEvent(CheckDistance, 200); ParticleSystemEvents.AddTimedEvent(TotalTimeInSeconds, MarkComplete); // Call function to add Magnet Particle Event ToogleMagnetsAffectPositionOrVelocity(); // Specify to use the Point Magnet by default MagnetList.Clear(); MagnetList.Add(new MagnetPoint(DestionationPosition, MagnetsMode, MagnetsDistanceFunction, _minDistance, _maxDistance, MagnetsForce, 0)); }
/// <summary> /// Load the Particle System Events and any other settings /// </summary> public void LoadParticleSystem() { //----------------------------------------------------------- // TODO: Setup the Particle System to achieve the desired result. // You may change all of the code in this function. It is just // provided to show you how to setup a simple particle system. //----------------------------------------------------------- // Set the Function to use to Initialize new Particles. // The Default Templates include a Particle Initialization Function called // InitializeParticleUsingInitialProperties, which initializes new Particles // according to the settings in the InitialProperties object (see further below). // You can also create your own Particle Initialization Functions as well, as shown with // the InitializeParticleProperties function below. ParticleInitializationFunction = InitializeParticleUsingInitialProperties; //ParticleInitializationFunction = InitializeParticleProperties; // Setup the Initial properties of the Particles. // These are only applied if using InitializeParticleUsingInitialProperties // as the Particle Initialization Function. InitialProperties.LifetimeMin = 2.0f; InitialProperties.LifetimeMax = 2.0f; InitialProperties.PositionMin = Vector3.Zero; InitialProperties.PositionMax = Vector3.Zero; InitialProperties.VelocityMin = new Vector3(-50, 50, -50); InitialProperties.VelocityMax = new Vector3(50, 100, 50); InitialProperties.RotationMin = new Vector3(0, 0, 0); InitialProperties.RotationMax = new Vector3(0, 0, MathHelper.Pi); InitialProperties.RotationalVelocityMin = new Vector3(0, 0, -MathHelper.Pi); InitialProperties.RotationalVelocityMax = new Vector3(0, 0, MathHelper.Pi); InitialProperties.StartWidthMin = 10; InitialProperties.StartWidthMax = 40; InitialProperties.StartHeightMin = 10; InitialProperties.StartHeightMax = 40; InitialProperties.EndWidthMin = 30; InitialProperties.EndWidthMax = 30; InitialProperties.EndHeightMin = 30; InitialProperties.EndHeightMax = 30; InitialProperties.StartColorMin = Color.Black; InitialProperties.StartColorMax = Color.White; InitialProperties.EndColorMin = Color.Black; InitialProperties.EndColorMax = Color.White; // Remove all Events first so that none are added twice if this function is called again ParticleEvents.RemoveAllEvents(); ParticleSystemEvents.RemoveAllEvents(); // Allow the Particle's Position, Rotation, Width and Height, Color, Transparency, and Orientation to be updated each frame ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationUsingRotationalVelocity); ParticleEvents.AddEveryTimeEvent(UpdateParticleWidthAndHeightUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleColorUsingLerp); // This function must be executed after the Color Lerp function as the Color Lerp will overwrite the Color's // Transparency value, so we give this function an Execution Order of 100 to make sure it is executed last. ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeOutUsingLerp, 100); // Update the particle to face the camera. Do this after updating it's rotation/orientation. ParticleEvents.AddEveryTimeEvent(UpdateParticleToFaceTheCamera, 200); // Set the Particle System's Emitter to toggle on and off every 0.5 seconds ParticleSystemEvents.LifetimeData.EndOfLifeOption = CParticleSystemEvents.EParticleSystemEndOfLifeOptions.Repeat; ParticleSystemEvents.LifetimeData.Lifetime = 1.0f; ParticleSystemEvents.AddTimedEvent(0.0f, UpdateParticleSystemEmitParticlesAutomaticallyOn); ParticleSystemEvents.AddTimedEvent(0.5f, UpdateParticleSystemEmitParticlesAutomaticallyOff); // Setup the Emitter Emitter.ParticlesPerSecond = 50; Emitter.PositionData.Position = new Vector3(0, 0, 0); }
/// <summary> /// Load the Particle System Events and any other settings /// </summary> public void LoadParticleSystem() { //----------------------------------------------------------- // TODO: Setup the Particle System to achieve the desired result. // You may change all of the code in this function. It is just // provided to show you how to setup a simple particle system. //----------------------------------------------------------- // Set the Function to use to Initialize new Particles. // The Default Templates include a Particle Initialization Function called // InitializeParticleUsingInitialProperties, which initializes new Particles // according to the settings in the InitialProperties object (see further below). // You can also create your own Particle Initialization Functions as well, as shown with // the InitializeParticleProperties function below. ParticleInitializationFunction = InitializeParticleUsingInitialProperties; //ParticleInitializationFunction = InitializeParticleProperties; // Setup the Initial Properties of the Particles. // These are only applied if using InitializeParticleUsingInitialProperties // as the Particle Initialization Function. topVelocity = new Vector3(0, 0, 0); lowVelocity = new Vector3(0, 0, 0); InitialProperties.LifetimeMin = 0.2f; InitialProperties.LifetimeMax = 0.22f; InitialProperties.PositionMin = Vector3.Zero; InitialProperties.PositionMax = Vector3.Zero; InitialProperties.VelocityMin = lowVelocity; InitialProperties.VelocityMax = topVelocity; InitialProperties.RotationMin = 0; InitialProperties.RotationMax = 0; InitialProperties.RotationalVelocityMin = 0; InitialProperties.RotationalVelocityMax = 0; InitialProperties.StartWidthMin = size; InitialProperties.StartWidthMax = size; InitialProperties.StartHeightMin = size; InitialProperties.StartHeightMax = size; InitialProperties.EndWidthMin = size; InitialProperties.EndWidthMax = size; InitialProperties.EndHeightMin = size; InitialProperties.EndHeightMax = size; InitialProperties.StartColorMin = Color.White; InitialProperties.StartColorMax = Color.White; InitialProperties.EndColorMin = Color.Green; InitialProperties.EndColorMax = Color.Green; // Remove all Events first so that none are added twice if this function is called again ParticleEvents.RemoveAllEvents(); ParticleSystemEvents.RemoveAllEvents(); // Allow the Particle's Position, Rotation, Width and Height, Color, Transparency, and Orientation to be updated each frame ParticleEvents.AddEveryTimeEvent(UpdateParticlePosition); //ParticleEvents.AddEveryTimeEvent(UpdateParticleRotationUsingRotationalVelocity); //ParticleEvents.AddEveryTimeEvent(UpdateParticleWidthAndHeightUsingLerp); //ParticleEvents.AddEveryTimeEvent(UpdateParticleColorUsingLerp); ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyWithQuickFadeInAndSlowFadeOut, 100); // Setup the Emitter Emitter.ParticlesPerSecond = 500; Emitter.EmitParticlesAutomatically = false; Emitter.PositionData.Position = new Vector3(0, 0, 0); }