46 lines
1.4 KiB
JavaScript
Raw Permalink Normal View History

2015-02-06 10:38:23 -08:00
(function(){
var teleport;
var portalDestination;
var animationURL;
2015-02-06 10:38:23 -08:00
function playSound() {
Audio.playSound(teleport, { volume: 0.40, localOnly: true });
};
this.preload = function(entityID) {
teleport = SoundCache.getSound("http://s3.amazonaws.com/hifi-public/birarda/teleport.raw");
2015-02-06 10:38:23 -08:00
var properties = Entities.getEntityProperties(entityID);
animationURL = properties.modelURL;
2015-02-06 10:38:23 -08:00
print("The portal destination is " + portalDestination);
}
this.enterEntity = function(entityID) {
var properties = Entities.getEntityProperties(entityID); // in case the userData/portalURL has changed
portalDestination = properties.userData;
print("enterEntity() .... The portal destination is " + portalDestination);
2015-02-06 10:38:23 -08:00
if (portalDestination.length > 0) {
print("Teleporting to hifi://" + portalDestination);
Window.location = "hifi://" + portalDestination;
}
};
this.leaveEntity = function(entityID) {
Entities.editEntity(entityID, {
2015-10-07 13:02:58 -07:00
animation: { url: animationURL, currentFrame: 1, running: false }
2015-02-06 10:38:23 -08:00
});
playSound();
};
this.hoverEnterEntity = function(entityID) {
Entities.editEntity(entityID, {
2015-10-07 13:02:58 -07:00
animation: { url: animationURL, fps: 24, firstFrame: 1, lastFrame: 25, currentFrame: 1, running: true, hold: true }
2015-02-06 10:38:23 -08:00
});
};
})