24 lines
543 B
JavaScript
24 lines
543 B
JavaScript
import Component from '@/ecs/component.js';
|
|
|
|
export default class Sound extends Component {
|
|
mergeDiff(original, update) {
|
|
const merged = {};
|
|
if (update.play) {
|
|
merged.play = [
|
|
...(original.play ?? []),
|
|
...update.play,
|
|
];
|
|
}
|
|
return merged;
|
|
}
|
|
instanceFromSchema() {
|
|
const Component = this;
|
|
const Instance = super.instanceFromSchema();
|
|
return class SoundInstance extends Instance {
|
|
play(source) {
|
|
Component.markChange(this.entity, 'play', [source]);
|
|
}
|
|
};
|
|
}
|
|
}
|