fix wall not reappearing on pause

This commit is contained in:
Kevin Ngo
2018-10-12 03:52:11 -07:00
parent e0b312e95e
commit 69445acaef

View File

@@ -11,6 +11,10 @@ AFRAME.registerComponent('wall', {
this.el.object3D.visible = false;
},
play: function () {
this.el.object3D.visible = true;
},
tock: function (time, delta) {
this.el.object3D.position.z += this.data.speed * (delta / 1000);
this.returnToPool();
@@ -19,6 +23,7 @@ AFRAME.registerComponent('wall', {
returnToPool: function () {
if (this.el.object3D.position.z < this.maxZ) { return; }
this.el.sceneEl.components.pool__wall.returnEntity(this.el);
this.el.object3D.position.z = 9999;
this.el.pause();
},
});