ReactionsPlugin class final
A ReactionTable heard from the engine's bus, on the frame channel.
A view plugin. It subscribes to every event once a frame, after the frame's steps, and writes what the table makes of them into one pending Reaction the game takes with drain and performs: bursts into its particles, jolts onto its camera, the flash into its HUD. Nothing it does reaches the simulation, so switching it off is not written into a replay.
A rollback shows nothing twice. The frame channel hands out a step run
again only when it differs from what was shown; such an event is
Delivered.resimulated, and this skips it unless showCorrections is
set — sparks for a hit the rollback took back are already on screen, and a
second burst would be wrong both ways.
final reactions = ReactionsPlugin(table);
final loop = EngineLoop(input: input, plugins: [genre, reactions]);
// every frame:
reactions.take()
..showIn(particles)
..feel(camera.rig);
Constructors
- ReactionsPlugin(ReactionTable table, {String id = 'flutter3d_game_kit.reactions', bool showCorrections = false})
-
A plugin running
tableunderid, skipping rolled-back events unlessshowCorrectionsis set.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The plugin's id. Two tables in one engine need two.
final
- manifest → PluginManifest
-
What the plugin is and needs, read before it is installed: its id, the
API it was written against, its dependencies and what it touches.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showCorrections → bool
-
Whether an event a rollback changed is shown when it arrives again.
final
- table → ReactionTable
-
What each event looks like: the game's own table.
final
Methods
-
drain(
) → Reaction - Everything decided since the last call, and nothing pending after it.
-
install(
PluginHost host) → void - Registers this plugin's phases, systems, subscriptions and the rest.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
ready(
PluginHost host) → Future< void> -
Loads what the plugin needs before it is whole — a shader library its
lighting model draws with, a table its system reads — after
installhas registered everything, and completes when it has. Completes at once unless overridden.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
uninstall(
PluginHost host) → void - Releases what install took that is not a registration. The registrations themselves are cancelled by the host after this returns.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited