supercut cleanups

This commit is contained in:
Diego F. Goberna
2018-11-21 11:57:56 +01:00
parent e99bad99ad
commit 7822c8ffcb
6 changed files with 46 additions and 20 deletions

View File

@@ -8,6 +8,13 @@ const BEAT_WARMUP_ROTATION_TIME = 750;
const ONCE = {once: true};
const SIGN_MATERIAL = {shader: 'flat', color: '#88f'};
const SCORE_POOL = {
OK : 'pool__beatscoreok',
GOOD : 'pool__beatscoregood',
EXCELLENT : 'pool__beatscoreexcellent',
SUPER : 'pool__beatscoresuper'
};
/**
* Bears, beats, Battlestar Galactica.
* Create beat from pool, collision detection, clipping planes, movement, scoring.
@@ -744,18 +751,13 @@ AFRAME.registerComponent('beat', {
this.el.emit('beathit', hitEventDetail, true);
let beatScorePool;
if (score < 60) { beatScorePool = 'pool__beatscoreok'; }
else if (score < 80) { beatScorePool = 'pool__beatscoregood'; }
else if (score < 100) { beatScorePool = 'pool__beatscoreexcellent'; }
if (score < 60) { beatScorePool = SCORE_POOL.OK; }
else if (score < 80) { beatScorePool = SCORE_POOL.GOOD; }
else if (score < 100) { beatScorePool = SCORE_POOL.EXCELLENT; }
else {
beatScorePool = 'pool__beatscoresuper';
beatScorePool = SCORE_POOL.SUPER;
const supercut = this.superCuts[this.superCutIdx].getObject3D('mesh');
supercut.position.copy(this.el.object3D.position);
supercut.position.z = -1;
supercut.visible = true;
setTimeout(() => { supercut.visible = false; }, 1000);
supercut.material.uniforms.starttime.value = this.el.sceneEl.time - 50;
this.superCuts[this.superCutIdx].components.supercutfx.createSuperCut(this.el.object3D.position);
this.superCutIdx = (this.superCutIdx + 1) % this.superCuts.length;
}