KeywordDetector
Keyword detector.
| Type | Name | Interface Description |
|---|---|---|
| Variables | enabled: boolean | • Function: Whether the detector is enabled. |
| Variables | eventEmitter: IEventEmitter | • Function: The event emitter. |
| Variables | targetKeywords: string[] | • Function: The target keywords. |
Examples
eventEmitter: IEventEmitter
this.keywordDetector.eventEmitter.on(APJS.KeywordEventType.KeywordHit, (e) => {
const words = e.args[0];
console.log("Detected:", words);
});
targetKeywords: string[]
this.keywordDetector.targetKeywords = ["start", "stop"];
Use Case
@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use KeywordDetector here
}
onUpdate(deltaTime: number) {
}
}