fix clearing walls on restart/pause
This commit is contained in:
@@ -225,7 +225,13 @@ AFRAME.registerComponent('beat-loader', {
|
||||
this.beatsTime = 0;
|
||||
this.beatsTimeOffset = undefined;
|
||||
for (let i = 0; i < this.beatContainer.children.length; i++) {
|
||||
this.beatContainer.children[i].components.beat.returnToPool(true);
|
||||
let child = this.beatContainer.children[i];
|
||||
if (child.components.beat) {
|
||||
child.components.beat.returnToPool(true);
|
||||
}
|
||||
if (child.components.wall) {
|
||||
child.components.wall.returnToPool(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -7,6 +7,10 @@ AFRAME.registerComponent('wall', {
|
||||
this.maxZ = 10;
|
||||
},
|
||||
|
||||
pause: function () {
|
||||
this.el.object3D.visible = false;
|
||||
},
|
||||
|
||||
tock: function (time, delta) {
|
||||
this.el.object3D.position.z += this.data.speed * (delta / 1000);
|
||||
this.returnToPool();
|
||||
|
||||
Reference in New Issue
Block a user