Take damage when hitting mines
This commit is contained in:
@@ -144,7 +144,7 @@ AFRAME.registerComponent('beat', {
|
||||
var hitColliderConfiguration;
|
||||
var hitColliderEl;
|
||||
|
||||
if (this.data.type === 'dot') { return; }
|
||||
if (this.data.type === 'dot' || this.data.type === 'mine') { return; }
|
||||
|
||||
hitColliderConfiguration = {
|
||||
position: {x: 0, y: data.size / 2, z: 0},
|
||||
@@ -467,6 +467,11 @@ AFRAME.registerComponent('beat', {
|
||||
if (saberBoundingBox.intersectsBox(beatBoundingBox)) {
|
||||
this.el.parentNode.components['beat-hit-sound'].playSound(this.el);
|
||||
this.destroyBeat(saberEls[i]);
|
||||
if (this.data.type === 'mine') {
|
||||
this.el.emit('minehit', null, true);
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.data.type === 'dot' && saberEls[i].components['saber-controls'].swinging && this.data.color === saberColors[saberEls[i].getAttribute('saber-controls').hand]) {
|
||||
this.el.emit('beathit', null, true);
|
||||
} else {
|
||||
|
||||
@@ -186,6 +186,10 @@ AFRAME.registerState({
|
||||
state.menuSelectedChallenge.difficulty = difficulty;
|
||||
},
|
||||
|
||||
minehit: state => {
|
||||
takeDamage(state);
|
||||
},
|
||||
|
||||
pausegame: (state) => {
|
||||
if (!state.isPlaying) { return; }
|
||||
state.isPaused = true;
|
||||
|
||||
Reference in New Issue
Block a user