Class DashLight
Dashboard warning light driven off a UI Image. Hold time plus fade on the falling edge keeps intermittent signals from flickering.
Namespace: NWH.VehiclePhysics2.VehicleGUI
Assembly: NWH.VehiclePhysics2.dll
Syntax
[RequireComponent(typeof(Image))]
public class DashLight : MonoBehaviour
Fields
fadeTime
Fade-out duration in seconds once holdTime expires. 0 turns the light off instantly.
Declaration
[Tooltip("Time it takes for the light to turn off, once Hold Time expires. Imitates dash lights that use conventional bulbs.")]
public float fadeTime
Field Value
| Type | Description |
|---|---|
| float |
holdTime
Seconds to keep the light lit after Active goes false. Stops per-frame signals such as ABS or TCS from flickering.
Declaration
[Tooltip("Time it takes for the light to start turning off after the state has changed. Useful to remove flicker from signals that are not persistent but rather change on frame-to-frame basis, e.g. ABS and TCS. ")]
public float holdTime
Field Value
| Type | Description |
|---|---|
| float |
offColor
Image color when the light is inactive. Typically black or a dark version of the icon color.
Declaration
[Tooltip("Color of the ''Image'' when the light is off. Black by default.")]
public Color offColor
Field Value
| Type | Description |
|---|---|
| Color |
onColor
Image color when the light is active. Typically white or the characteristic color of the indicator (red, yellow, green, etc.).
Declaration
[Tooltip("Color of the ''Image'' when the light is on. White by default.")]
public Color onColor
Field Value
| Type | Description |
|---|---|
| Color |
Properties
Active
Active state. True lights up immediately, false starts the hold and fade-out sequence.
Declaration
public bool Active { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |