/// <summary> /// When overridden in the derived class, handles processing the <paramref name="particle"/> when /// it is updated. Only valid if <see cref="ParticleModifier.ProcessOnUpdate"/> is set. /// </summary> /// <param name="emitter">The <see cref="ParticleEmitter"/> that the <paramref name="particle"/> /// came from.</param> /// <param name="particle">The <see cref="Particle"/> to process.</param> /// <param name="elapsedTime">The amount of time that has elapsed since the <paramref name="emitter"/> /// was last updated.</param> protected override void HandleProcessUpdated(ParticleEmitter emitter, Particle particle, int elapsedTime) { var agePercent = particle.GetAgePercent(CurrentTime); if (AllBitsSet()) { particle.Color = ReleaseColor.Lerp(UltimateColor, agePercent); } else { byte r, g, b, a; if (ModifyRed) { r = (byte)MathHelper.Lerp(ReleaseColor.R, UltimateColor.R, agePercent); } else { r = particle.Color.R; } if (ModifyGreen) { g = (byte)MathHelper.Lerp(ReleaseColor.G, UltimateColor.G, agePercent); } else { g = particle.Color.G; } if (ModifyBlue) { b = (byte)MathHelper.Lerp(ReleaseColor.B, UltimateColor.B, agePercent); } else { b = particle.Color.B; } if (ModifyAlpha) { a = (byte)MathHelper.Lerp(ReleaseColor.A, UltimateColor.A, agePercent); } else { a = particle.Color.A; } particle.Color = new Color(r, g, b, a); } }
/// <summary> /// When overridden in the derived class, handles processing the <paramref name="particle"/> when /// it is updated. Only valid if <see cref="ParticleModifier.ProcessOnUpdate"/> is set. /// </summary> /// <param name="emitter">The <see cref="ParticleEmitter"/> that the <paramref name="particle"/> /// came from.</param> /// <param name="particle">The <see cref="Particle"/> to process.</param> /// <param name="elapsedTime">The amount of time that has elapsed since the <paramref name="emitter"/> /// was last updated.</param> protected override void HandleProcessUpdated(ParticleEmitter emitter, Particle particle, int elapsedTime) { var agePercent = particle.GetAgePercent(CurrentTime); if (AllBitsSet()) particle.Color = ReleaseColor.Lerp(UltimateColor, agePercent); else { byte r, g, b, a; if (ModifyRed) r = (byte)MathHelper.Lerp(ReleaseColor.R, UltimateColor.R, agePercent); else r = particle.Color.R; if (ModifyGreen) g = (byte)MathHelper.Lerp(ReleaseColor.G, UltimateColor.G, agePercent); else g = particle.Color.G; if (ModifyBlue) b = (byte)MathHelper.Lerp(ReleaseColor.B, UltimateColor.B, agePercent); else b = particle.Color.B; if (ModifyAlpha) a = (byte)MathHelper.Lerp(ReleaseColor.A, UltimateColor.A, agePercent); else a = particle.Color.A; particle.Color = new Color(r, g, b, a); } }
/// <summary> /// When overridden in the derived class, handles processing the <paramref name="particle"/> when /// it is updated. Only valid if <see cref="ParticleModifier.ProcessOnUpdate"/> is set. /// </summary> /// <param name="emitter">The <see cref="ParticleEmitter"/> that the <paramref name="particle"/> /// came from.</param> /// <param name="particle">The <see cref="Particle"/> to process.</param> /// <param name="elapsedTime">The amount of time that has elapsed since the <paramref name="emitter"/> /// was last updated.</param> protected override void HandleProcessUpdated(ParticleEmitter emitter, Particle particle, int elapsedTime) { particle.Scale = MathHelper.Lerp(InitialScale, UltimateScale, particle.GetAgePercent(CurrentTime)); }
/// <summary> /// When overridden in the derived class, handles processing the <paramref name="particle"/> when /// it is updated. Only valid if <see cref="ParticleModifier.ProcessOnUpdate"/> is set. /// </summary> /// <param name="emitter">The <see cref="ParticleEmitter"/> that the <paramref name="particle"/> /// came from.</param> /// <param name="particle">The <see cref="Particle"/> to process.</param> /// <param name="elapsedTime">The amount of time that has elapsed since the <paramref name="emitter"/> /// was last updated.</param> protected override void HandleProcessUpdated(ParticleEmitter emitter, Particle particle, int elapsedTime) { particle.Scale = MathHelper.Lerp(InitialScale, UltimateScale, particle.GetAgePercent(CurrentTime)); }