Struct PhysicsEventBuilder<T>
- Namespace
- LunyScript.Api
- Assembly
- LunyScript.dll
Fluent builder for filtered collision/trigger event sequences. Filters (Tagged, Named, Layered, Masked, Typed) are order-independent and accumulate. Event handlers (Begins, Updates, Ends) are also order-independent. Parameters within a filter kind are OR-combined; different kinds are AND-combined.
public readonly struct PhysicsEventBuilder<T> where T : struct, ICollisionBuilderState
Type Parameters
T
Methods
Begins(params ScriptActionBlock[])
Blocks to run when the collision/trigger begins.
public PhysicsEventBuilder<CollisionBuilderReady> Begins(params ScriptActionBlock[] blocks)
Parameters
blocksScriptActionBlock[]
Returns
Continues(params ScriptActionBlock[])
Blocks to run each physics step while the collision/trigger persists.
public PhysicsEventBuilder<CollisionBuilderReady> Continues(params ScriptActionBlock[] blocks)
Parameters
blocksScriptActionBlock[]
Returns
Cooldown(double)
Minimum seconds between successive reactions. Zero (default) means no cooldown. The cooldown is checked before collision predicates; evaluated per event sequence.
public PhysicsEventBuilder<CollisionBuilderReady> Cooldown(double seconds)
Parameters
secondsdouble
Returns
Ends(params ScriptActionBlock[])
Blocks to run when the collision/trigger ends.
public PhysicsEventBuilder<CollisionBuilderReady> Ends(params ScriptActionBlock[] blocks)
Parameters
blocksScriptActionBlock[]
Returns
Layered(params string[])
Only react when the other object is on one of the given layers (OR logic). Mutually exclusive with Masked() — Masked() becomes unavailable after calling this.
public PhysicsEventBuilder<CollisionBuilderLayered> Layered(params string[] layerNames)
Parameters
layerNamesstring[]
Returns
Tagged(params string[])
Only react when the other object has one of the given tags (OR logic). Combine with other filter kinds for AND logic across kinds.
public PhysicsEventBuilder<CollisionBuilderReady> Tagged(params string[] tags)
Parameters
tagsstring[]
Returns
Typed(params Type[])
Only react when the other object's component list contains at least one of the given types (OR logic).
public PhysicsEventBuilder<CollisionBuilderReady> Typed(params Type[] componentTypes)
Parameters
componentTypesType[]
Returns
With(params string[])
Only react when the other object's name matches one of the given names (OR logic).
public PhysicsEventBuilder<CollisionBuilderReady> With(params string[] names)
Parameters
namesstring[]