stage colors reset
This commit is contained in:
@@ -4,7 +4,8 @@ AFRAME.registerComponent('stage-colors', {
|
||||
dependencies: ['background', 'fog'],
|
||||
|
||||
schema: {
|
||||
color: {default: 'blue', oneOf: ['blue', 'red']}
|
||||
color: {default: 'blue', oneOf: ['blue', 'red']},
|
||||
isGameOver: {default: false}
|
||||
},
|
||||
|
||||
init: function () {
|
||||
@@ -55,6 +56,9 @@ AFRAME.registerComponent('stage-colors', {
|
||||
update: function (oldData) {
|
||||
const red = this.data.color === 'red';
|
||||
|
||||
// Let game over animations do the work. Only update when leaving game over state.
|
||||
if (!oldData.isGameOver && this.data.isGameOver) { return; }
|
||||
|
||||
// Init or reset.
|
||||
this.backglow.getObject3D('mesh').material.color.set(red ? '#f10' : '#00acfc');
|
||||
this.sky.getObject3D('mesh').material.color.set(red ? '#f10' : '#00acfc');
|
||||
|
||||
@@ -18,9 +18,10 @@
|
||||
bind__beat-loader="challengeId: challenge.id; difficulty: challenge.difficulty; isPlaying: isPlaying"
|
||||
bind__gameover="isGameOver: isGameOver"
|
||||
bind__intro-song="isPlaying: menu.active && !menuSelectedChallenge.id"
|
||||
bind__overlay="enabled: !isPlaying"
|
||||
bind__song="challengeId: challenge.id; isPlaying: isPlaying; isBeatsPreloaded: challenge.isBeatsPreloaded; isGameOver: isGameOver"
|
||||
bind__song-preview-system="challengeId: challenge.id; isSongLoading: isSongLoading; selectedChallengeId: menuSelectedChallenge.id"
|
||||
bind__overlay="enabled: !isPlaying"
|
||||
bind__stage-colors="isGameOver: isGameOver"
|
||||
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"
|
||||
console-shortcuts
|
||||
|
||||
Reference in New Issue
Block a user