Skip to main content

Class: LightManager

Creates and updates light components.

Constructors

Constructor

new LightManager(): LightManager;

Returns

LightManager

Methods

Create()

static Create(entity, type): Promise<boolean>;

Creates a light component on an entity.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
typeLightTypeThe light type to create.

Returns

Promise<boolean>

A promise that resolves to true if the light component was created, or false otherwise.


Destroy()

static Destroy(entity): Promise<boolean>;

Removes a light component from an entity.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.

Returns

Promise<boolean>

A promise that resolves to true if the light component was removed, or false otherwise.


HasComponent()

static HasComponent(entity): Promise<boolean>;

Checks whether an entity has a light component.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<boolean>

A promise that resolves to true if the entity has a light component, or false otherwise.


SetEnabled()

static SetEnabled(entity, enabled): Promise<void>;

Sets whether a light component is enabled.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
enabledbooleanWhether the light component is enabled.

Returns

Promise<void>

A promise that resolves when the enabled state has been changed.


GetEnabled()

static GetEnabled(entity): Promise<boolean>;

Gets whether a light component is enabled.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<boolean>

A promise that resolves to true if the light component is enabled, or false otherwise.


SetType()

static SetType(entity, type): Promise<void>;

Sets the light type.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
typeLightTypeThe light type to assign.

Returns

Promise<void>

A promise that resolves when the light type has been changed.


GetType()

static GetType(entity): Promise<LightType>;

Gets the light type.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<LightType>

A promise that resolves to the light type.


SetColor()

static SetColor(entity, rgb): Promise<void>;

Sets the light color.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
rgbvec3The RGB color as a vec3, with each channel in the range [0.0, 1.0].

Returns

Promise<void>

A promise that resolves when the color has been changed.


GetColor()

static GetColor(entity): Promise<vec3>;

Gets the light color.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<vec3>

A promise that resolves to the RGB color as a vec3, with each channel in the range [0.0, 1.0].


SetIntensity()

static SetIntensity(entity, intensity): Promise<void>;

Sets the light intensity.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
intensitynumberThe light intensity.

Returns

Promise<void>

A promise that resolves when the intensity has been changed.


GetIntensity()

static GetIntensity(entity): Promise<number>;

Gets the light intensity.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<number>

A promise that resolves to the light intensity.


SetRange()

static SetRange(entity, range): Promise<void>;

Sets the light range.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
rangenumberThe light range.

Returns

Promise<void>

A promise that resolves when the range has been changed.


GetRange()

static GetRange(entity): Promise<number>;

Gets the light range.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<number>

A promise that resolves to the light range.


SetSpotAngle()

static SetSpotAngle(entity, angle): Promise<void>;

Sets the spot angle in degrees.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
anglenumberThe spot angle in degrees.

Returns

Promise<void>

A promise that resolves when the spot angle has been changed.


GetSpotAngle()

static GetSpotAngle(entity): Promise<number>;

Gets the spot angle in degrees.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<number>

A promise that resolves to the spot angle in degrees.


SetShadows()

static SetShadows(entity, mode): Promise<void>;

Sets the shadow mode of a light.

Parameters

ParameterTypeDescription
entitynumberThe Entity to update.
modeLightShadowModeThe shadow mode to assign.

Returns

Promise<void>

A promise that resolves when the shadow mode has been changed.


GetShadows()

static GetShadows(entity): Promise<LightShadowMode>;

Gets the shadow mode of a light.

Parameters

ParameterTypeDescription
entitynumberThe Entity to inspect.

Returns

Promise<LightShadowMode>

A promise that resolves to the shadow mode.