initial game over slowdown (will tween the rate / fade out later)

This commit is contained in:
Kevin Ngo
2018-10-10 23:21:48 -07:00
parent c9f94914a5
commit 69a755da90
4 changed files with 9 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ var utils = require('../utils');
AFRAME.registerComponent('song-preview-system', {
schema: {
debug: {default: false},
isSongLoading: {default: false}, // Continue to play preview song during loading.
selectedChallengeId: {type: 'string'}
},
@@ -36,10 +37,8 @@ AFRAME.registerComponent('song-preview-system', {
update: function (oldData) {
const data = this.data;
if (oldData.selectedChallengeId &&
oldData.selectedChallengeId !== data.selectedChallengeId) {
this.stopSong();
}
// Continue to play preview song during loading to keep entertained.
if (oldData.isSongLoading && !data.isSongLoading) { this.stopSong(); }
// Selected challenge ID updated.
if (data.selectedChallengeId && oldData.selectedChallengeId !== data.selectedChallengeId) {

View File

@@ -50,10 +50,10 @@ AFRAME.registerComponent('song', {
// Game over, slow down audio, and then stop.
if (!oldData.isGameOver && data.isGameOver) {
this.source.playbackRate = 0.5;
this.source.playbackRate.value = 0.75;
setTimeout(() => {
this.stopAudio();
}, 1000);
}, 2000);
return;
}