/// <summary> /// Toggles if Magnets should affect the Particles' Position or Velocity, and adds /// the appropriate Particle Event to do so. /// </summary> public void ToogleMagnetsAffectPositionOrVelocity() { // Remove the previous Magnet Particle Events ParticleEvents.RemoveAllEventsInGroup(1); // Specify that Magnets should affect the Particles' Velocity //ParticleEvents.AddEveryTimeEvent(UpdateParticleVelocityAccordingToMagnets, 0, 1); ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionAccordingToMagnets, 0, 1); }
public void AddMagnetParticleEvent() { // Remove the Magnet Particle Events ParticleEvents.RemoveAllEventsInGroup(1); // If the Magnets should affect Position if (mbMagnetsAffectPosition) { ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionAccordingToMagnets, 500, 1); } // Else the Magnets should affect Velocity else { ParticleEvents.AddEveryTimeEvent(UpdateParticleVelocityAccordingToMagnets, 500, 1); } }