pause logic (not yet resume logic)

This commit is contained in:
Kevin Ngo
2018-10-03 18:58:26 -07:00
parent 9392e57133
commit e9c6c4a9f0
7 changed files with 58 additions and 23 deletions

View File

@@ -8,7 +8,8 @@ AFRAME.registerComponent('beat-loader', {
beatAnticipationTime: {default: 2.0},
beatSpeed: {default: 4.0},
challengeId: {type: 'string'},
difficulty: {type: 'string'}
difficulty: {type: 'string'},
isPaused: {default: false}
},
orientations: [180, 0, 270, 90, 225, 135, 315, 45, 0],
@@ -53,6 +54,9 @@ AFRAME.registerComponent('beat-loader', {
console.log('Finished loading challenge data.');
},
/**
* Generate beats and stuff according to timestamp.
*/
tick: function (time, delta) {
var audioEl = this.el.components.song.audio;
var i;
@@ -62,7 +66,7 @@ AFRAME.registerComponent('beat-loader', {
var msPerBeat;
var noteTime;
if (!this.data.challengeId || !this.beatData || !audioEl) { return; }
if (this.data.isPaused || !this.data.challengeId || !this.beatData || !audioEl) { return; }
notes = this.beatData._notes;
obstacles = this.beatData._obstacles;