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