Skip to main content

Beam

A class in Root.Township, the global namespace.

One light beam cast from an ILightEmitter, tracking which ILightDetector it is hitting. Plain class, not a component.

Constructors​

MemberWhat it is
Beam(ILightEmitter emitter, Beam beam)Creates a Beam from emitter and beam.

Properties​

MemberWhat it is
Vector3 Direction { get; private set; }The direction of the last Emit.
ILightEmitter Emitter { get; }The light emitter that owns this beam. Its Distance and Mask control the raycast.
ILightDetector Hit { get; private set; }The light detector the beam is hitting now, or null.
Beam Parent { get; }Meant to be the beam this one came from, but the constructor never sets it, so it is always null.
RaycastHit RaycastHit { get; private set; }The raycast result of the last Emit that hit something. Not cleared when the beam misses.
Vector3 Start { get; private set; }The start point of the last Emit.

Methods​

MemberWhat it is
void Emit(Vector3 start, Vector3 direction)Raycasts from a start point along a direction using the emitter's distance and mask, telling detectors when the beam starts or stops hitting them.
void Stop()Tells the current detector the beam has left it and clears Hit.
1 private and internal method
MemberWhat it is
private void DrawRay()Debug-draws the beam: white for no hit, blue for hitting a collider, green for hitting a light detector.

Used in​

Members of other types that take, return or hold a Beam: