restore stage colors to red/blue schema

This commit is contained in:
Kevin Ngo
2018-10-12 01:10:09 -07:00
parent 7f459109ca
commit eab3d67f39
3 changed files with 11 additions and 12 deletions

View File

@@ -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 () {

View File

@@ -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;

View File

@@ -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">
<a-assets timeout="10000">