Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / SlotChooser

Class: SlotChooser ​

Defined in: audio/soundBank.ts:66

Decides whether a slot sounds and which take: chance, cooldown, and never the same take twice running when there's another. No audio here, so it's testable.

Constructors ​

Constructor ​

ts
new SlotChooser(random?): SlotChooser;

Defined in: audio/soundBank.ts:70

Parameters ​

ParameterTypeDefault value
random() => numberMath.random

Returns ​

SlotChooser

Methods ​

choose() ​

ts
choose(
   id, 
   slot, 
   now): SoundTake | null;

Defined in: audio/soundBank.ts:73

The take to play now, or null to stay silent. now is in milliseconds.

Parameters ​

ParameterType
idstring
slotSoundSlot
nownumber

Returns ​

SoundTake | null