overte/examples/audioExamples/acAudioSearching/soundEntityScript.js
2016-02-02 14:50:30 -08:00

30 lines
1 KiB
JavaScript

// soundEntityScript.js
//
// Script Type: Entity
// Created by Eric Levin on 2/2/16.
// Copyright 2016 High Fidelity, Inc.
//
// This entity script sends a message meant for a running AC script on preload
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
(function() {
Script.include("../../libraries/utils.js");
var _this;
// this is the "constructor" for the entity as a JS object we don't do much here
var SoundEntity = function() {
_this = this;
this.MESSAGE_CHANNEL = "Hifi-Sound-Entity";
};
SoundEntity.prototype = {
preload: function(entityID) {
this.entityID = entityID;
print("EBL SENDING MESSAGE " + this.entityID);
Messages.sendMessage(this.MESSAGE_CHANNEL, JSON.stringify({id: this.entityID}));
},
};
// entity scripts always need to return a newly constructed object of our type
return new SoundEntity();
});