Skip to main content

PlatformLightDarknessReader

A class in Root.Township, the global namespace.

Darkness reader method that checks every so often whether the local player's head is out of range of all platform lights, and requests a spawn if so. Client-side.

Constructors​

MemberWhat it is
PlatformLightDarknessReader(DarknessReader reader, PlayerController character, Action requestSpawn)Creates a PlatformLightDarknessReader from reader, character and requestSpawn.

Fields​

2 private and internal fields
MemberWhat it is
private float timerTime left until the next darkness check.
private IUnityUpdateMethod updateThe registered late update method, or null when not running.

Methods​

MemberWhat it is
protected override void DisableInternal()Stops the update loop and unhooks the local player event.
protected override void EnableInternal()Resets the timer, starts the update loop if there's a local player, and watches for the local player changing.
3 private and internal methods
MemberWhat it is
private bool IsInDarkness()True when no relevant platform light is within range of the head (range scaled by settings, within 10 m vertically).
private void UpdateLoop()Counts down and, every read interval, requests a spawn if the player is in darkness.
private void UpdatePlayer(PlayerController player)Starts or stops the update loop when the local player is set or cleared.