victory logic

This commit is contained in:
Kevin Ngo
2018-10-08 16:24:31 -07:00
parent 89346178f6
commit de47cdb5e2
2 changed files with 14 additions and 1 deletions

View File

@@ -23,6 +23,14 @@ AFRAME.registerComponent('song', {
audio.play();
}
});
audio.addEventListener('ended', () => {
if (this.data.isPlaying) {
this.el.sceneEl.emit('victory', null, false);
audio.pause();
audio.currentTime = 0;
}
});
},
update: function (oldData) {