content/hifi-content/caitlyn/production/minigolf course/teleportByHyperLinkv2.js
2022-02-13 22:19:19 +01:00

30 lines
952 B
JavaScript

(function(){
var teleport;
var portalDestination;
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');
}
this.enterEntity = function(entityID) {
print('Enter event');
var properties = Entities.getEntityProperties(entityID, ['href']); // in case the href has changed
if (properties) {
portalDestination = properties.href;
}
print('enterEntity() .... The portal destination is ' + portalDestination);
if (portalDestination.length > 0) {
print('Teleporting to ' + portalDestination);
Window.location = portalDestination;
}
};
this.leaveEntity = function(entityID) {
playSound();
};
})