differentiate play/pause vs. resume for beat generate

This commit is contained in:
Kevin Ngo
2018-10-23 03:29:01 -07:00
parent 406d064026
commit f94a0d88da
2 changed files with 15 additions and 8 deletions

View File

@@ -228,6 +228,7 @@ AFRAME.registerComponent('beat-loader', {
this.orientations[noteInfo._cutDirection]);
beatEl.play();
beatEl.components.beat.onGenerate();
};
})(),

View File

@@ -85,12 +85,16 @@ AFRAME.registerComponent('beat', {
}
},
pause: function () {
this.el.object3D.visible = false;
this.partLeftEl.object3D.visible = false;
this.partRightEl.object3D.visible = false;
},
play: function () {
this.blockEl.object3D.visible = true;
this.destroyed = false;
this.el.object3D.visible = true;
this.startPositionZ = this.el.object3D.position.z;
this.el.object3D.position.z -= BEAT_WARMUP_OFFSET;
},
tock: function (time, timeDelta) {
@@ -120,6 +124,14 @@ AFRAME.registerComponent('beat', {
this.returnToPool();
},
/**
* Called when summoned by beat-loader.
*/
onGenerate: function () {
this.startPositionZ = this.el.object3D.position.z;
this.el.object3D.position.z -= BEAT_WARMUP_OFFSET;
},
initBlock: function () {
var el = this.el;
var blockEl = this.blockEl = document.createElement('a-entity');
@@ -381,12 +393,6 @@ AFRAME.registerComponent('beat', {
};
})(),
pause: function () {
this.el.object3D.visible = false;
this.partLeftEl.object3D.visible = false;
this.partRightEl.object3D.visible = false;
},
initCuttingClippingPlanes: function () {
this.leftCutPlanePointsWorld = [
new THREE.Vector3(),