Cleanup tutorial.js and remove unused code

This commit is contained in:
Ryan Huffman 2016-10-06 13:53:21 -07:00
parent a5e3fa45c3
commit 56a5d82f4b

View file

@ -236,21 +236,7 @@ var stepDisableControllers = function(name) {
stepDisableControllers.prototype = { stepDisableControllers.prototype = {
start: function(onFinish) { start: function(onFinish) {
controllerDisplayManager = new ControllerDisplayManager(); controllerDisplayManager = new ControllerDisplayManager();
editEntitiesWithTag('door', { visible: true, collisionless: false }); disableEverything();
Menu.setIsOptionChecked("Overlays", false);
Controller.disableMapping('handControllerPointer-click');
Messages.sendLocalMessage('Hifi-Advanced-Movement-Disabler', 'disable');
Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'both');
Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({
nearGrabEnabled: true,
holdEnabled: false,
farGrabEnabled: false,
}));
setControllerPartLayer('touchpad', 'blank');
setControllerPartLayer('tips', 'blank');
hideEntitiesWithTag('finish');
setAwayEnabled(false);
onFinish(); onFinish();
}, },
@ -258,12 +244,24 @@ stepDisableControllers.prototype = {
} }
}; };
/////////////////////////////////////////////////////////////////////////////// function disableEverything() {
/////////////////////////////////////////////////////////////////////////////// editEntitiesWithTag('door', { visible: true, collisionless: false });
// // Menu.setIsOptionChecked("Overlays", false);
// STEP: ENABLE CONTROLLERS // Controller.disableMapping('handControllerPointer-click');
// // Messages.sendLocalMessage('Hifi-Advanced-Movement-Disabler', 'disable');
/////////////////////////////////////////////////////////////////////////////// Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'both');
Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({
nearGrabEnabled: true,
holdEnabled: false,
farGrabEnabled: false,
}));
setControllerPartLayer('touchpad', 'blank');
setControllerPartLayer('tips', 'blank');
hideEntitiesWithTag('finish');
setAwayEnabled(false);
}
function reenableEverything() { function reenableEverything() {
editEntitiesWithTag('door', { visible: false, collisionless: true }); editEntitiesWithTag('door', { visible: false, collisionless: true });
Menu.setIsOptionChecked("Overlays", true); Menu.setIsOptionChecked("Overlays", true);
@ -285,6 +283,13 @@ function reenableEverything() {
setAwayEnabled(true); setAwayEnabled(true);
} }
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// //
// STEP: ENABLE CONTROLLERS //
// //
///////////////////////////////////////////////////////////////////////////////
var stepEnableControllers = function(name) { var stepEnableControllers = function(name) {
this.tag = name; this.tag = name;
this.shouldLog = false; this.shouldLog = false;
@ -321,45 +326,6 @@ stepWelcome.prototype = {
} }
}; };
function StayInFrontOverlay(type, properties, distance, positionOffset) {
this.currentOrientation = MyAvatar.orientation;
this.currentPosition = MyAvatar.position;
this.distance = distance;
this.positionOffset = positionOffset;
var forward = Vec3.multiply(this.distance, Quat.getFront(this.currentOrientation));
properties.rotation = this.currentOrientation;
properties.position = Vec3.sum(Vec3.sum(this.currentPosition, forward), this.positionOffset);
this.overlayID = Overlays.addOverlay(type, properties);
this.distance = distance;
this.boundUpdate = this.update.bind(this);
Script.update.connect(this.boundUpdate);
}
StayInFrontOverlay.prototype = {
update: function(dt) {
var targetOrientation = MyAvatar.orientation;
var targetPosition = MyAvatar.position;
this.currentOrientation = Quat.slerp(this.currentOrientation, targetOrientation, 0.05);
this.currentPosition = Vec3.mix(this.currentPosition, targetPosition, 0.05);
var forward = Vec3.multiply(this.distance, Quat.getFront(this.currentOrientation));
Overlays.editOverlay(this.overlayID, {
position: Vec3.sum(Vec3.sum(this.currentPosition, forward), this.positionOffset),
rotation: this.currentOrientation,
});
},
destroy: function() {
Overlays.deleteOverlay(this.overlayID);
try {
Script.update.disconnect(this.boundUpdate);
} catch(e) {
}
}
};
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -858,8 +824,6 @@ var stepTeleport = function(name) {
} }
stepTeleport.prototype = { stepTeleport.prototype = {
start: function(onFinish) { start: function(onFinish) {
//setControllerVisible("teleport", true);
setControllerPartLayer('touchpad', 'teleport'); setControllerPartLayer('touchpad', 'teleport');
setControllerPartLayer('tips', 'teleport'); setControllerPartLayer('tips', 'teleport');
@ -926,9 +890,6 @@ stepFinish.prototype = {
onFinish(); onFinish();
}, },
cleanup: function() { cleanup: function() {
//Menu.setIsOptionChecked("Overlays", true);
//hideEntitiesWithTag(this.tag);
//deleteEntitiesWithTag(this.tempTag);
} }
}; };