30 lines
952 B
JavaScript
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();
|
|
};
|
|
})
|