Vehicle Light

VehicleLight is a container for one or more LightSource objects, allowing a single vehicle light to be represented by multiple components.
Overview
A VehicleLight groups multiple LightSource implementations that turn on/off together as a single unit. For example, a headlight can combine:
- A Spot Light for scene illumination
- An emissive mesh for the lens glow effect
Properties
lightSources - List of LightSource components controlled together by this VehicleLight.
On - Gets or sets whether the light is currently on. For proper control, use SetState(), TurnOn(), or TurnOff() instead of setting directly.
Methods
SetState(bool state) - Sets the light state. Calls TurnOn() if true, TurnOff() if false.
Toggle() - Toggles the current state.
TurnOn() - Turns on all light sources in the collection.
TurnOff() - Turns off all light sources in the collection.
Usage
VehicleLight instances are typically managed by the LightsManager component, which handles headlights, brake lights, turn signals, and other vehicle lighting automatically based on input and vehicle state.