Class: ParticleEmitter<Effects>
Particle emitter aspect of an entity.
The particle emitter can have multiple effects which can be typed with a generics type, for
example ParticleEmitter<'fx1' | 'fx2'>
. When the config is passed directly to the
ParticleEmitter
constructor the effect types are automatically deduced. The Effects
type
defaults to a simple string
so just using ParticleEmitter
has loose typing for the effect
names.
Note that there is no way to do a type-safe generics access via ParticleSystem.getAspect
so
the type-safety only applies when the created reference is used directly or stored to a properly
typed variable.
Type parameters
Name | Type |
---|---|
Effects |
extends string = string |
Constructors
constructor
• new ParticleEmitter<Effects
>(config
): ParticleEmitter
<Effects
>
Type parameters
Name | Type |
---|---|
Effects |
extends string = string |
Parameters
Name | Type |
---|---|
config |
ParticleEmitterConfig <Effects > |
Returns
ParticleEmitter
<Effects
>
Properties
effects
• Readonly
effects: Record
<Effects
, Emitter
>
Methods
emit
▸ emit(effects
): void
Emit a single effect or multiple effects.
Parameters
Name | Type | Description |
---|---|---|
effects |
Effects | Effects [] |
Effect(s) to emit |
Returns
void