LightSource class
A light that does not need to be attached to a component.
Add it through LightingInterface.addLight and remove it with LightingInterface.removeLight:
final flash = gameRef.lighting.addLight(
LightSource(
position: player.absoluteCenter.clone(),
config: LightingConfig(
radius: 160,
color: Colors.white.withValues(alpha: 0.9),
mode: LightingMode.additive,
falloff: LightFalloff.smooth,
),
),
);
gameRef.lighting.removeLight(flash);
Useful for short-lived effects (explosions, muzzle flashes), ambient details and lights that do not have a component of their own.
Constructors
- LightSource({required Vector2 position, required LightingConfig config, bool enabled = true, double angle = 0})
Properties
- angle ↔ double
-
Rotation angle in radians. Used by ArcLightingType.
getter/setter pair
- config ↔ LightingConfig
-
Configuration of the light.
getter/setter pair
- enabled ↔ bool
-
Whether this light is rendered.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- position ↔ Vector2
-
World position of the light center.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited