PhysicsLayers Class
Definition
Namespace: Brine2D.Physics
A static registry that maps named physics layers to their integer index \(0–63\). Register layers once at startup; then use MaskFor\(ReadOnlySpan<string>\) to build collision masks. Thread-safe for concurrent reads after all registrations are complete.
Inheritance System.Object → PhysicsLayers
| Methods | |
|---|---|
| Clear() | Removes all registered layers. Intended for test teardown. |
| Get\(string\) | Returns the layer index for name. |
| MaskFor\(ReadOnlySpan<string>\) | Returns a collision mask with bits set for each named layer. |
| Register\(string, int\) | Registers a named layer. index must be in [0, 63]. Re-registering the same name with the same index is a no-op. Re-registering with a different index throws System.InvalidOperationException. |
| TryGet\(string, int\) | Returns the layer index, or false if not found. |