Skip to main content

LightHands

A class in Root.Township, the global namespace.

Debug light on a player's hand, toggled by the DebugLight controller action for users with the debug_features permission. Cycles off, strong and flickering.

Constructors​

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

Fields​

9 private and internal fields
MemberWhat it is
private LightHands.Modes currentModeOff, strong or flickering.
private float fadeTimeSeconds to fade in or out. 0.5.
private Gradient flickColorsGradient used while flickering.
private float flickRangeLight range while flickering.
private float intensityLight intensity while flickering.
private float lerpSpeedHow fast the flicker colour drifts.
private PlatformLight lightObjectThe hand light.
private float strongRangeLight range in strong mode.
private float timeFade progress in seconds.

Properties​

1 private and internal property
MemberWhat it is
private bool IsFlickering { get; set; }True in flickering mode, where Update changes the colour.

Methods​

MemberWhat it is
void Toggle()Moves to the next mode: off fades out, strong is white at long range, flickering is short range with shifting colours.
6 private and internal methods
MemberWhat it is
private IEnumerator AmpUp() (iterator)Coroutine that turns the light on and fades its intensity up to 1.
private void ButtonPressed(PlayerInput controller)Handles the DebugLight action. Does the same as Toggle.
private IEnumerator FadeOut() (iterator)Coroutine that fades the light out, then turns it and this component off.
private void OnDestroy()Destroys the light along with this component.
private void Start()Subscribes to the DebugLight action if the user has debug_features.
private void Update()While flickering, drifts the colour towards random gradient colours.