
Audio From Array Player
Downloads: 2
Download Description
Plays a single AudioComponent from an array of SceneObjects with AudioComponents.
//
// AudioFromArrayPlayer.ts
// Plays a single AudioComponent from an array of SceneObjects with AudioComponents.
// The index of the SceneObject to play is determined by the 'index' input.
// Written by @Fusedthreed – https://FusedThreeD.com
//
@customNode()
export class PlayAudio extends BasicScriptNode {
@input()
SceneObject_audio!: APJS.SceneObject[];
@input()
index: number = 0;
execute() {
const audio = this.SceneObject_audio[this.index].getComponent('AudioComponent') as APJS.AudioComponent;
audio.play();
}
}