reduce delay between hit and hearing sound (trimmed audio file more, got rid of event

This commit is contained in:
Kevin Ngo
2018-10-12 00:40:22 -07:00
parent 62dd94e571
commit c7feccf133
4 changed files with 11 additions and 13 deletions

View File

@@ -421,12 +421,14 @@ AFRAME.registerComponent('beat', {
saberBoundingBox = saberEls[i].components['saber-controls'].boundingBox;
if (!boundingBox || !saberBoundingBox) { break; }
if (saberBoundingBox.intersectsBox(boundingBox)) {
this.el.emit('beathit', this.el);
this.el.emit('beathit', null, false);
this.el.parentNode.components['beat-hit-sound'].playSound(this.el);
this.destroyBeat(saberEls[i]);
break;
}
if (saberBoundingBox.intersectsBox(beatBoundingBox)) {
this.el.emit('beathit', this.el);
this.el.emit('beathit', null, false);
this.el.parentNode.components['beat-hit-sound'].playSound(this.el);
this.destroyBeat(saberEls[i]);
this.wrongCut(saberEls[i].getAttribute('saber-controls').hand);
break;