content/hifi-content/brosche/Hackathon/2018/lightSwitch.js
2022-02-13 21:50:01 +01:00

45 lines
No EOL
1.1 KiB
JavaScript

// lightSwitch.js
// Created by Mark Brosche on 10-26-2018
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* global */
(function(){
var _this;
var LampControl = function(){
_this = this;
};
LampControl.prototype = {
preload: function (entityID) {
_this.entityID = entityID;
},
clickReleaseOnEntity: function (id, event) {
if (id === _this.entityID) {
Entities.callEntityServerMethod(_this.entityID, "togglePower");
}
},
stopNearTrigger: function (id, handUserID){
if (id === _this.entityID) {
Entities.callEntityServerMethod(_this.entityID, "togglePower");
}
},
stopFarTrigger: function (id, handUserID){
if (id === _this.entityID) {
Entities.callEntityServerMethod(_this.entityID, "togglePower");
}
}
};
return new LampControl();
});