/// <summary> /// The update method is used by the emitter to apply the action /// to every particle. It is called within the emitter's update /// loop and need not be called by the user. /// </summary> /// <param name="emitter">The Emitter that created the particle.</param> /// <param name="particle">The particle to be updated.</param> /// <param name="elapsedTime">The duration of the frame - used for time based updates.</param> public override void Update(Emitter emitter, Particle particle, double elapsedTime) { bool inside = m_zone.Contains(particle.X, particle.Y); if (m_invertZone) { inside = !inside; } if (inside) { particle.IsDead = true; } }
/// <summary> /// The update method is used by the emitter to apply the action /// to every particle. It is called within the emitter's update /// loop and need not be called by the user. /// </summary> /// <param name="emitter">The Emitter that created the particle.</param> /// <param name="particle">The particle to be updated.</param> /// <param name="elapsedTime">The duration of the frame - used for time based updates.</param> public override void Update(Emitter emitter, Particle particle, double elapsedTime) { if (m_zone.Contains(particle.X, particle.Y)) { if (!m_invert) { m_action.Update(emitter, particle, elapsedTime); } } else { if (m_invert) { m_action.Update(emitter, particle, elapsedTime); } } }
/// <summary> /// The update method is used by the emitter to apply the action /// to every particle. It is called within the emitter's update /// loop and need not be called by the user. /// </summary> /// <param name="emitter">The Emitter that created the particle.</param> /// <param name="particle">The particle to be updated.</param> /// <param name="elapsedTime">The duration of the frame - used for time based updates.</param> public override void Update(Emitter emitter, Particle particle, double elapsedTime) { if (m_zone.Contains(particle.X, particle.Y)) { if (!m_invert) { particle.VelocityX += m_x * elapsedTime; particle.VelocityY += m_y * elapsedTime; } } else { if (m_invert) { particle.VelocityX += m_x * elapsedTime; particle.VelocityY += m_y * elapsedTime; } } }