Manages Lights for a Scene.
Affects the rendering of Game Objects using the Light2D
pipeline.
new LightsManager()
Whether the Lights Manager is enabled.
The Lights in the Scene.
The maximum number of lights that a single Camera and the lights shader can process.
Change this via the maxLights
property in your game config, as it cannot be changed at runtime.
The number of lights that the LightPipeline processed in the previous frame.
Add a Light.
name | type | arguments | Default | description |
---|---|---|---|---|
x | number | <optional> | 0 |
The horizontal position of the Light. |
y | number | <optional> | 0 |
The vertical position of the Light. |
radius | number | <optional> | 100 |
The radius of the Light. |
rgb | number | <optional> | 0xffffff |
The integer RGB color of the light. |
intensity | number | <optional> | 1 |
The intensity of the Light. |
The Light that was added.
Destroy the Lights Manager.
Cleans up all references by calling Phaser.GameObjects.LightsManager#shutdown.
Disable the Lights Manager.
This Lights Manager object.
Enable the Lights Manager.
This Lights Manager object.
Get the number of Lights managed by this Lights Manager.
The number of Lights managed by this Lights Manager.
Get all lights that can be seen by the given Camera.
It will automatically cull lights that are outside the world view of the Camera.
If more lights are returned than supported by the pipeline, the lights are then culled based on the distance from the center of the camera. Only those closest are rendered.
name | type | description |
---|---|---|
camera | Phaser.Cameras.Scene2D.Camera |
The Camera to cull Lights for. |
The culled Lights.
Returns the maximum number of Lights allowed to appear at once.
The maximum number of Lights allowed to appear at once.
Remove a Light.
name | type | description |
---|---|---|
light | Phaser.GameObjects.Light |
The Light to remove. |
This Lights Manager object.
Set the ambient light color.
name | type | description |
---|---|---|
rgb | number |
The integer RGB color of the ambient light. |
This Lights Manager object.
Shut down the Lights Manager.
Recycles all active Lights into the Light pool, resets ambient light color and clears the lists of Lights and culled Lights.