content/hifi-content/elisalj/hub/swallowDesktopPill.js
2022-02-13 23:16:46 +01:00

35 lines
No EOL
1.2 KiB
JavaScript

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