One thing that happens to a particle while it is alive.
Why these are objects
The alternative is an effect with a field for every behaviour anybody might want — gravity, drag, a start colour, an end colour, a size curve, a wind vector — where every effect carries the whole set and most of them are zero. Adding turbulence then means editing the effect, the update loop and every existing effect's constructor.
A list of affectors instead: an effect names only what applies to it, a new
one is a new class and nothing else changes, and a game built on this engine
can add its own without touching the engine at all. The update loop knows
nothing but apply.
They are const and stateless, so one instance is shared by every particle of every effect that uses it.
Constructors
- ParticleAffector()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
apply(
Particle particle, double dt) → void -
Advances one particle by
dt. Called once per particle per step, after its age has been updated and before it is moved. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited