fix scoring/damage hook up on beat hit/misses
This commit is contained in:
@@ -209,7 +209,7 @@ AFRAME.registerComponent('beat', {
|
||||
wrongEl.object3D.position.y += 0.2;
|
||||
wrongEl.object3D.position.z -= 0.5;
|
||||
wrongEl.object3D.visible = true;
|
||||
wrongEl.emit('wronghit', null, false);
|
||||
wrongEl.emit('beatwrong', null, true);
|
||||
this.destroyed = true;
|
||||
},
|
||||
|
||||
@@ -220,7 +220,7 @@ AFRAME.registerComponent('beat', {
|
||||
missEl.object3D.position.y += 0.2;
|
||||
missEl.object3D.position.z -= 0.5;
|
||||
missEl.object3D.visible = true;
|
||||
missEl.emit('beatmiss', null, false);
|
||||
missEl.emit('beatmiss', null, true);
|
||||
},
|
||||
|
||||
destroyBeat: (function () {
|
||||
@@ -432,7 +432,7 @@ AFRAME.registerComponent('beat', {
|
||||
saberBoundingBox = saberEls[i].components['saber-controls'].boundingBox;
|
||||
if (!boundingBox || !saberBoundingBox) { break; }
|
||||
if (saberBoundingBox.intersectsBox(boundingBox)) {
|
||||
this.el.emit('goodhit', null, false);
|
||||
this.el.emit('beathit', null, true);
|
||||
this.el.parentNode.components['beat-hit-sound'].playSound(this.el);
|
||||
this.destroyBeat(saberEls[i]);
|
||||
break;
|
||||
@@ -441,7 +441,7 @@ AFRAME.registerComponent('beat', {
|
||||
this.el.parentNode.components['beat-hit-sound'].playSound(this.el);
|
||||
this.destroyBeat(saberEls[i]);
|
||||
if (this.data.type === 'dot') {
|
||||
this.el.emit('goodhit', null, false);
|
||||
this.el.emit('beathit', null, true);
|
||||
} else {
|
||||
this.wrongHit(saberEls[i].getAttribute('saber-controls').hand);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ AFRAME.registerState({
|
||||
localStorage.setItem('activeHand', state.activeHand);
|
||||
},
|
||||
|
||||
goodhit: state => {
|
||||
beathit: state => {
|
||||
if (state.damage > DAMAGE_DECAY) {
|
||||
state.damage -= DAMAGE_DECAY;
|
||||
}
|
||||
@@ -91,13 +91,14 @@ AFRAME.registerState({
|
||||
state.score.combo += 1;
|
||||
},
|
||||
|
||||
/**
|
||||
* Not implemented.
|
||||
*/
|
||||
beatmiss: state => {
|
||||
takeDamage(state);
|
||||
},
|
||||
|
||||
beatwrong: state => {
|
||||
takeDamage(state);
|
||||
},
|
||||
|
||||
beatloaderfinish: (state) => {
|
||||
state.challenge.isLoading = false;
|
||||
},
|
||||
@@ -244,10 +245,6 @@ AFRAME.registerState({
|
||||
|
||||
victory: function (state) {
|
||||
state.isVictory = true;
|
||||
},
|
||||
|
||||
wronghit: state => {
|
||||
takeDamage(state);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user