Rewrote the particles to allow for more advanced particles.
+ Particles can now be detached from the object. + Each particle now has an own Lifetime, that can be controlled. + Particles can now appear in a continuous way.
This commit is contained in:
parent
651628401d
commit
db7f01dca1
9 changed files with 171 additions and 109 deletions
|
|
@ -14,17 +14,17 @@ namespace SM.Base.Drawing.Particles
|
|||
/// <summary>
|
||||
/// Default movement for 2D.
|
||||
/// </summary>
|
||||
public static Vector2 Default2D(Vector2 direction, ParticleContext context)
|
||||
public static Vector2 Default2D(ParticleInstance<Vector2> particle)
|
||||
{
|
||||
return direction * (context.Timer.Elapsed * context.Speed);
|
||||
return particle.Direction * ((particle.StartLifetime - particle.Lifetime) * particle.Speed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default movement for 3D.
|
||||
/// </summary>
|
||||
public static Vector3 Default3D(Vector3 direction, ParticleContext context)
|
||||
public static Vector3 Default3D(ParticleInstance<Vector3> particle)
|
||||
{
|
||||
return direction * (context.Timer.Elapsed * context.Speed);
|
||||
return particle.Direction * ((particle.StartLifetime - particle.Lifetime) * particle.Speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue