From e5b2483604e6a97fe6436fdede480d29c107cec5 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Mon, 21 Mar 2016 14:09:02 -0700 Subject: [PATCH] sound seems to be working" --- .../batonSoundTestEntityScript.js | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/examples/tests/batonSoundEntityTest/batonSoundTestEntityScript.js b/examples/tests/batonSoundEntityTest/batonSoundTestEntityScript.js index fed025f9b3..67197a3c9f 100644 --- a/examples/tests/batonSoundEntityTest/batonSoundTestEntityScript.js +++ b/examples/tests/batonSoundEntityTest/batonSoundTestEntityScript.js @@ -4,7 +4,7 @@ var baton; var iOwn = false; - var updateLoopConnected = false; + var soundIntervalConnected = false; var _this; BatonSoundEntity = function() { @@ -23,18 +23,21 @@ // We already have our injector so just restart it _this.soundInjector.restart(); } + print("EBL SETTING TIMEOUT") + _this.playSoundInterval = Script.setInterval(function() { + print("EBL RESTART"); + _this.soundInjector.restart(); + }, _this.drumSound.duration * 1000); // Duration is in seconds so convert to ms iOwn = true; - updateLoopConnected = true; - print("START UPDATE"); - Script.update.connect(_this.update); + soundIntervalConnected = true; } function stopUpdateAndReclaim() { // when the baton is release print("CLAIM BATON") - if (updateLoopConnected === true) { - updateLoopConnected = false; - Script.update.disconnect(_this.update); + if (soundIntervalConnected === true) { + soundIntervalConnected = false; + Script.clearInterval(_this.playSoundInterval); } iOwn = false; @@ -63,9 +66,9 @@ }, unload: function() { - if (updateLoopConnected === true) { - updateLoopConnected = false; - Script.update.disconnect(_this.update); + if (soundIntervalConnected === true) { + soundIntervalConnected = false; + Script.clearInterval(_this.playSoundInterval); } }