TriggerVolume class final
A volume that fires its target when something walks into it.
Listens for the collision rather than polling, so a fast body cannot cross a thin trigger between two steps without being noticed — the world's sweep found the overlap, and this only has to hear about it.
- Inheritance
- Mixed-in types
Constructors
- TriggerVolume({String? name, required String target, required Collider collider, bool once = false})
-
A volume over
collider, which it turns into a trigger listening to itself.
Properties
- collider → Collider
-
The volume a body walks into; its
userDatais this trigger.final - hashCode → int
-
The hash code for this object.
no setterinherited
- isSpent → bool
-
Whether this has already fired and will not fire again.
no setterinherited
- name → String?
-
What other entities call this one, when anything does.
finalinherited
- once → bool
-
Whether it works only the first time. A trap door should not rearm; a
lift call button should.
finalinherited
- origin → Vector3?
-
Where this is, for anything that wants to make a noise there.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- target → String
-
The Mechanism.name this switches on.
finalinherited
- world → MechanismWorld
-
The world this belongs to, once it has been added to one.
no setterinherited
Methods
-
activate(
Activation by) → ActivationOutcome -
Stepping into a trigger is the activation; asking it directly does the
same thing, which is what lets one trigger be chained from another.
override
-
collect(
MechanismEvents into) → void -
The last thing this told the player, for the frame it happened on.
override
-
drainOutcome(
) → ActivationOutcome? - The outcome the last trigger left, taken so it is not read twice; null when nothing has been said since the last call (absent, not an error).
-
fire(
Activation by) → ActivationOutcome -
Passes the activation on to target.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onCollision(
CollisionContext context) → void -
Called for every step the pair stays overlapping, the first one excepted.
inherited
-
onCollisionEnd(
CollisionContext context) → void -
Called on the first step the pair no longer overlaps. Nothing, by
default.
inherited
-
onCollisionStart(
CollisionContext context) → void -
Called on the first step the pair overlaps. Nothing, by default.
override
-
restore(
Map< String, Object?> from) → void -
Puts back what save took. Given the same map it produced.
inherited
-
save(
) → Map< String, Object?> -
The latch, and nothing else.
inherited
-
step(
double dt) → void -
Advances by
dt. Called every simulation step, for every mechanism.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited