disable text counters unless victory

This commit is contained in:
Kevin Ngo
2018-12-10 17:11:00 -08:00
parent eb1d7fa322
commit a3048456d5
2 changed files with 5 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ AFRAME.registerComponent('text-counter', {
schema: {
decimals: {default: 0},
dur: {default: 2000, type: 'int'},
enabled: {default: false},
emit: {default: false},
prefix: {default: ''},
suffix: {default: ''},
@@ -25,7 +26,7 @@ AFRAME.registerComponent('text-counter', {
},
tick: function (time, timeDelta) {
if (this.currentValue >= this.data.value) { return; }
if (!this.data.enabled || this.currentValue >= this.data.value) { return; }
this.currentValue += this.data.value * (timeDelta / this.data.dur);

View File

@@ -29,7 +29,7 @@
<a-entity
id="victoryInfoAccuracy"
mixin="font"
bind__text-counter="value: score.accuracy"
bind__text-counter="enabled: isVictory; value: score.accuracy"
text="align: left; color: #FAFAFA; wrapCount: 22; baseline: top; width: 0.81; value: 0.00%"
text-counter="suffix: %; decimals: 2; emit: true"
proxy-event="event: textcounterdone; to: .accuracyTextCounterSubscribe"
@@ -48,7 +48,7 @@
id="victoryInfoScore"
mixin="font"
text="value: 0; align: center; color: #FAFAFA; wrapCount: 15; baseline: top; width: 2.25"
bind__text-counter="value: score.score"
bind__text-counter="enabled: isVictory; value: score.score"
position="0 -0.19 0"></a-entity>
<a-entity
@@ -56,7 +56,7 @@
mixin="font"
text="align: center; color: #FAFAFA; wrapCount: 22; baseline: top; width: 1"
text-counter="prefix: MAX COMBO: "
bind__text-counter="value: score.maxCombo"
bind__text-counter="enabled: isVictory; value: score.maxCombo"
position="0 -0.3 0"></a-entity>
<a-entity