3
0
Fork 0
mirror of https://github.com/JulianGro/overte.git synced 2025-04-29 23:03:00 +02:00

lights turning on and off

This commit is contained in:
ericrius1 2016-03-16 19:03:36 -07:00
parent 1fb1e32a85
commit 03c1bd2970

View file

@ -7,7 +7,7 @@
var DIFFUSE_TEXTURE_URL = "http://hifi-content.s3.amazonaws.com/highfidelity_diffusebaked.png";
var _this;
var utilitiesScript = Script.resolvePath('../../../../libraries/utils.js');
var utilitiesScript = Script.resolvePath('../utils.js');
Script.include(utilitiesScript);
Switch = function() {
_this = this;
@ -15,7 +15,7 @@
};
Switch.prototype = {
prefix: 'hifi-home-dressing-room-disc-light',
prefix: 'hifi-home-dressing-room-disc-',
clickReleaseOnEntity: function(entityID, mouseEvent) {
if (!mouseEvent.isLeftButton) {
return;
@ -27,13 +27,13 @@
this.toggleLights();
},
modelEmitOn: function(discModel) {
modelEmitOn: function(glowDisc) {
Entities.editEntity(glowDisc, {
textures: 'emissive:' + EMISSIVE_TEXTURE_URL ',\ndiffuse:"' + DIFFUSE_TEXTURE_URL + '"'
})
textures: 'emissive:' + EMISSIVE_TEXTURE_URL + ',\ndiffuse:"' + DIFFUSE_TEXTURE_URL + '"'
});
},
modelEmitOff: function(discModel) {
modelEmitOff: function(glowDisc) {
Entities.editEntity(glowDisc, {
textures: 'emissive:"",\ndiffuse:"' + DIFFUSE_TEXTURE_URL + '"'
})
@ -45,7 +45,7 @@
});
},
masterLightOff: function() {
masterLightOff: function(masterLight) {
Entities.editEntity(masterLight, {
visible: false
});
@ -101,15 +101,13 @@
toggleLights: function() {
this.switch = getEntityCustomData('home-switch', this.entityID, {
state: 'off'
});
_this._switch = getEntityCustomData('home-switch', _this.entityID, {state: 'off'});
var glowLights = this.findGlowLights();
var masterLights = this.findMasterLights();
var emitModels = this.findEmitModels();
if (this.switch.state === 'off') {
if (this._switch.state === 'off') {
glowLights.forEach(function(glowLight) {
_this.glowLightOn(glowLight);
});
@ -119,7 +117,7 @@
emitModels.forEach(function(emitModel) {
_this.modelEmitOn(emitModel);
});
setEntityCustomData('home-switch', this.entityID, {
setEntityCustomData('home-switch', _this.entityID, {
state: 'on'
});