Skip to main content

PuzzleLightMirror

A class in Root.Township, the global namespace.

Light puzzle mirror: each beam that hits it spawns a reflected beam, with a limit on how often one beam chain can bounce off the same mirror.

Constructors​

MemberWhat it is
PuzzleLightMirror()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

2 private and internal fields
MemberWhat it is
private Dictionary<Beam, Beam> mappingIncoming beam to reflected beam pairs.
private int singleBeamHitCountHow many times one beam chain may hit this mirror.

Methods​

MemberWhat it is
void BeginHit(Beam incoming)Creates a reflected beam for a new incoming beam if allowed, and enables the mirror.
void EndHit(Beam incoming)Stops the reflected beam for that incoming beam; disables the mirror when none are left.
protected override void Awake()Starts disabled until a beam hits it.
protected virtual bool IsAllowed(Beam incoming)False if the incoming beam's chain has already hit this mirror singleBeamHitCount times.
protected override void Update()Re-emits each reflected beam from its incoming beam's hit point, mirrored on the hit normal.