// // swallowDesktopPill.js // Play a swallow sound and trigger visual effects after a pill has been swallowed // // Author: Elisa Lupin-Jimenez // Copyright High Fidelity 2018 // // Licensed under the Apache 2.0 License // See accompanying license file or http://apache.org/ // // All assets are under CC Attribution Non-Commerical // http://creativecommons.org/licenses/ // (function() { var SWALLOW_PILL_SCRIPT = Script.resolvePath('swallowFXPill.js?107'); var SWALLOW_PILL = Script.require(SWALLOW_PILL_SCRIPT); var PILL_EFFECT_LENGTH_MS = 10000; var isInactive = true; this.mousePressOnEntity = function(entityID) { print("pill has been clicked"); if (isInactive) { isInactive = false; Render.getConfig("RenderMainView").getConfig("DebugDeferredBuffer").size = {x: -1, y: -1, z: 1, w: 1}; SWALLOW_PILL.playSwallowEffect(null, false); Script.setTimeout(function() { isInactive = true; Render.getConfig("RenderMainView").getConfig("DebugDeferredBuffer").size = {x: 0, y: -1, z: 1, w: 1}; }, PILL_EFFECT_LENGTH_MS); } } });