/// <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 SetupToAutoExplodeEveryInterval(float intervalInSeconds) { // Set the Particle System's Emitter to release a burst of particles after a set interval ParticleSystemEvents.RemoveAllEventsInGroup(1); ParticleSystemEvents.LifetimeData.EndOfLifeOption = CParticleSystemEvents.EParticleSystemEndOfLifeOptions.Repeat; ParticleSystemEvents.LifetimeData.Lifetime = intervalInSeconds; ParticleSystemEvents.AddTimedEvent(0.0f, UpdateParticleSystemToExplode, 0, 1); }
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 = 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 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 = .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 void BonusLux(Vector3 mys) { //LoadParticleSystem(); // Remove the unnecessary event that was added in the LoadEmitterMagnetParticleSytem() function ParticleSystemEvents.RemoveEveryTimeEvent(UpdateEmitterMagnetToTheEmittersPosition, 0, 0); // Clear the Magnets List if (this.MagnetList != null) { MagnetList.Clear(); // Add two Point Magnets MagnetList.Add(new MagnetPoint(mys, DefaultParticleSystemMagnet.MagnetModes.Attract, DefaultParticleSystemMagnet.DistanceFunctions.SquaredInverse, 0, 100, 20, 0)); } }
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)); }
// Use this for initialization void Start() { Looper = GetComponent<EffectLooper>(); ParticleEvents = GetComponent<ParticleSystemEvents>(); ParticleEvents.OnComplete += ParticleEvents_OnComplete; }
/// <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); }