From eab3d67f3983ee004f5a61fc2625a019bbd33cc6 Mon Sep 17 00:00:00 2001 From: Kevin Ngo Date: Fri, 12 Oct 2018 01:10:09 -0700 Subject: [PATCH] restore stage colors to red/blue schema --- src/components/gameover.js | 1 + src/components/stage-colors.js | 20 +++++++++----------- src/index.html | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/components/gameover.js b/src/components/gameover.js index eb41caf..065ec58 100644 --- a/src/components/gameover.js +++ b/src/components/gameover.js @@ -29,6 +29,7 @@ AFRAME.registerComponent('gameover', { reset: function () { this.beatContainer.object3D.position.z = 0; + this.el.sceneEl.setAttribute('stage-colors', 'color', 'blue'); }, triggerAnimations: function () { diff --git a/src/components/stage-colors.js b/src/components/stage-colors.js index 9cc4a88..b5cc975 100644 --- a/src/components/stage-colors.js +++ b/src/components/stage-colors.js @@ -2,7 +2,7 @@ AFRAME.registerComponent('stage-colors', { dependencies: ['background', 'fog'], schema: { - isGameOver: {default: false} + color: {default: 'blue', oneOf: ['blue', 'red']} }, init: function () { @@ -19,9 +19,9 @@ AFRAME.registerComponent('stage-colors', { this.mineMaterial = new THREE.MeshStandardMaterial({ roughness: 0.38, metalness: 0.48, - color: this.mineColor[this.data], - emissive: this.mineEmission[this.data], - envMap: this.mineEnvMap[this.data] + color: this.mineColor[this.data.color], + emissive: this.mineEmission[this.data.color], + envMap: this.mineEnvMap[this.data.color] }); this.sky = document.getElementById('sky'); this.backglow = document.getElementById('backglow'); @@ -31,15 +31,13 @@ AFRAME.registerComponent('stage-colors', { }, update: function (oldData) { - const red = this.data.isGameOver; + const red = this.data.color === 'red'; // Init or reset. - if (!('isGameOver' in oldData) || (oldData.isGameOver && !this.data.isGameOver)) { - this.backglow.getObject3D('mesh').material.color.set('#00acfc'); - this.sky.getObject3D('mesh').material.color.set('#00acfc'); - this.el.sceneEl.object3D.background.set('#15252d'); - this.el.sceneEl.object3D.fog.color.set('#007cb9'); - } + this.backglow.getObject3D('mesh').material.color.set(red ? '#f10' : '#00acfc'); + this.sky.getObject3D('mesh').material.color.set(red ? '#f10' : '#00acfc'); + this.el.sceneEl.object3D.background.set(red ? '#770100': '#15252d'); + this.el.sceneEl.object3D.fog.color.set(red ? '#a00' : '#007cb9'); this.el.sceneEl.systems.materials.neon.color = red ? this.neonRed : this.neonBlue; this.el.sceneEl.systems.materials.default.color = red ? this.defaultRed : this.defaultBlue; diff --git a/src/index.html b/src/index.html index 9cc9df9..6607548 100644 --- a/src/index.html +++ b/src/index.html @@ -19,7 +19,6 @@ bind__intro-song="isPlaying: menu.active && !menuSelectedChallenge.id" bind__song="challengeId: challenge.id; isPlaying: isPlaying; isBeatsPreloaded: challenge.isBeatsPreloaded; isGameOver: isGameOver" bind__song-preview-system="isSongLoading: isSongLoading; selectedChallengeId: menuSelectedChallenge.id" - bind__stage-colors="isGameOver: isGameOver" bind__overlay="enabled: !isPlaying" animation__gameover="property: object3D.background; type: color; to: #750000; startEvents: gameover" animation__gameoverfog="property: components.fog.el.object3D.fog.color; type: color; to: #330000; startEvents: gameover; dur: 500; easing: easeInQuad" @@ -38,6 +37,7 @@ proxy-event__cleargame1="event: pausemenuexit; as: cleargame; to: a-scene" proxy-event__cleargame2="event: pausemenurestart; as: cleargame; to: a-scene" search + stage-colors="color: blue" fog="color: #a00; density: 0.035; type: exponential" vr-mode-ui="enterVRButton: #vrButton">