59 lines
No EOL
1.8 KiB
JavaScript
59 lines
No EOL
1.8 KiB
JavaScript
(function(){
|
|
var FIRE_BY_GAS_MAIN_1 = "{358ac501-b964-4502-a0d6-2be2be3691cd}";
|
|
var FIRE_BY_GAS_MAIN_2 = "{358ac501-b964-4502-a0d6-2be2be3691cd}";
|
|
var FIRE_BY_GENERATOR = "{84d98c70-fe1c-4624-a8ba-d0e9171a1e46}";
|
|
var FIRE_BY_CAFE = "{358ac501-b964-4502-a0d6-2be2be3691cd}";
|
|
|
|
var _this;
|
|
|
|
var Button = function() {
|
|
_this = this;
|
|
};
|
|
|
|
Button.prototype = {
|
|
preload: function(entityID) {
|
|
print("loaded");
|
|
_this.entityID = entityID;
|
|
_this.reset();
|
|
},
|
|
reset: function() {
|
|
Entities.editEntity(_this.entityID, {
|
|
rotation: Quat.fromVec3Degrees({x:0,y:0,z:0})
|
|
});
|
|
},
|
|
mousePressOnEntity: function(entityID, mouseEvent) {
|
|
print("mouse");
|
|
Entities.editEntity(_this.entityID, {
|
|
angularVelocity: {x:0,y:0.5,z:0}
|
|
});
|
|
var yaw = Entities.getEntityProperties(_this.entityID, 'rotation').rotation.y;
|
|
print(yaw);
|
|
if (yaw > 90) {
|
|
|
|
Entities.editEntity(FIRE_BY_GAS_MAIN_1, {
|
|
visible: false,
|
|
collisionless: true
|
|
});
|
|
|
|
Entities.editEntity(FIRE_BY_GAS_MAIN_2, {
|
|
visible: false,
|
|
collisionless: true
|
|
});
|
|
|
|
Entities.editEntity(FIRE_BY_GENERATOR, {
|
|
visible: false,
|
|
collisionless: true,
|
|
locked: true
|
|
});
|
|
|
|
Entities.editEntity(FIRE_BY_CAFE, {
|
|
visible: false,
|
|
collisionless: true,
|
|
locked: true
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
return new Button();
|
|
}); |