initial wall sound effect

This commit is contained in:
Kevin Ngo
2018-10-13 09:41:37 -07:00
parent ec306a80ae
commit 1ba3bd1492
7 changed files with 48 additions and 13 deletions

View File

@@ -9,21 +9,23 @@ AFRAME.registerComponent('wall', {
pause: function () {
this.el.object3D.visible = false;
this.el.removeAttribute('collidable');
},
play: function () {
this.el.object3D.visible = true;
this.el.setAttribute('collidable', '');
},
tock: function (time, delta) {
this.el.object3D.position.z += this.data.speed * (delta / 1000);
this.returnToPool();
if (this.el.object3D.position.z > this.maxZ) { this.returnToPool(); }
},
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();
this.el.removeAttribute('collidable');
},
});