From a3048456d55baa8d56f23faace4c3e6c31320f6c Mon Sep 17 00:00:00 2001 From: Kevin Ngo Date: Mon, 10 Dec 2018 17:11:00 -0800 Subject: [PATCH] disable text counters unless victory --- src/components/text-counter.js | 3 ++- src/templates/victory.html | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/text-counter.js b/src/components/text-counter.js index c1f4b6f..358b387 100644 --- a/src/components/text-counter.js +++ b/src/components/text-counter.js @@ -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); diff --git a/src/templates/victory.html b/src/templates/victory.html index 48ed3af..90cf89b 100644 --- a/src/templates/victory.html +++ b/src/templates/victory.html @@ -29,7 +29,7 @@