Ready for user testing v1

This commit is contained in:
Ryan Huffman 2016-09-02 08:47:09 -07:00
parent 5d9cc4782d
commit e8a1f50aee
2 changed files with 61 additions and 5 deletions

View file

@ -207,6 +207,27 @@ function isFunction(functionToCheck) {
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
} }
var defaultTransform = {
position: {
x: 0.2459,
y: 0.9011,
z: 0.7266
},
rotation: {
x: 0,
y: 0,
z: 0,
w: 1
}
};
function playSuccessSound() {
this.soundInjector = Audio.playSound(successSound, {
position: defaultTransform.position,
volume: 0.7,
loop: false
});
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// // // //
@ -488,6 +509,8 @@ stepEquip.prototype = {
showEntitiesWithTag(this.tag); showEntitiesWithTag(this.tag);
showEntitiesWithTag(this.tagPart1); showEntitiesWithTag(this.tagPart1);
this.hasFinished = false;
var basketColliderID = findEntity({ name: GUN_BASKET_COLLIDER_NAME }, 10000); var basketColliderID = findEntity({ name: GUN_BASKET_COLLIDER_NAME }, 10000);
var basketPosition = Entities.getEntityProperties(basketColliderID, 'position').position; var basketPosition = Entities.getEntityProperties(basketColliderID, 'position').position;
@ -543,13 +566,23 @@ stepEquip.prototype = {
// If block gets too far away or hasn't been touched for X seconds, create a new block and destroy the old block // If block gets too far away or hasn't been touched for X seconds, create a new block and destroy the old block
}, },
onMessage: function(channel, message, sender) { onMessage: function(channel, message, sender) {
if (this.hasFinished) {
return;
}
print("Got message", channel, message, sender, MyAvatar.sessionUUID); print("Got message", channel, message, sender, MyAvatar.sessionUUID);
//if (sender === MyAvatar.sessionUUID) { //if (sender === MyAvatar.sessionUUID) {
var data = parseJSON(message); var data = parseJSON(message);
print("Here", data.action, data.grabbedEntity, this.gunID); print("Here", data.action, data.grabbedEntity, this.gunID);
if (data.action == 'release' && data.grabbedEntity == this.gunID) { if (data.action == 'release' && data.grabbedEntity == this.gunID) {
try {
Messages.messageReceived.disconnect(this.onMessage);
} catch(e) {
}
playSuccessSound();
print("FINISHED"); print("FINISHED");
this.onFinish(); Script.setTimeout(this.onFinish.bind(this), 1500);
this.hasFinished = true;
//this.onFinish();
} }
//} //}
}, },
@ -586,8 +619,31 @@ var stepTurnAround = function(name) {
stepTurnAround.prototype = { stepTurnAround.prototype = {
start: function(onFinish) { start: function(onFinish) {
showEntitiesWithTag(this.tag); showEntitiesWithTag(this.tag);
var hasTurnedAround = false;
this.interval = Script.setInterval(function() {
var dir = Quat.getFront(MyAvatar.orientation);
var angle = Math.atan2(dir.z, dir.x);
var angleDegrees = ((angle / Math.PI) * 180);
print("CHECK");
if (!hasTurnedAround) {
if (Math.abs(angleDegrees) > 100) {
hasTurnedAround = true;
print("half way there...");
}
} else {
if (Math.abs(angleDegrees) < 30) {
Script.clearInterval(this.interval);
this.interval = null;
print("DONE");
onFinish();
}
}
}.bind(this), 100);
}, },
cleanup: function() { cleanup: function() {
if (this.interval) {
Script.clearInterval(this.interval);
}
hideEntitiesWithTag(this.tag); hideEntitiesWithTag(this.tag);
deleteEntitiesWithTag(this.tempTag); deleteEntitiesWithTag(this.tempTag);
} }
@ -610,7 +666,6 @@ stepTeleport.prototype = {
start: function(onFinish) { start: function(onFinish) {
setControllerVisible("teleport", true); setControllerVisible("teleport", true);
Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'none'); Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'none');
Menu.setIsOptionChecked("Overlays", true);
// Wait until touching teleport pad... // Wait until touching teleport pad...
var padID = findEntity({ name: TELEPORT_PAD_NAME }, 100); var padID = findEntity({ name: TELEPORT_PAD_NAME }, 100);
@ -663,6 +718,7 @@ var stepFinish = function(name) {
} }
stepFinish.prototype = { stepFinish.prototype = {
start: function(onFinish) { start: function(onFinish) {
Menu.setIsOptionChecked("Overlays", true);
showEntitiesWithTag(this.tag); showEntitiesWithTag(this.tag);
}, },
cleanup: function() { cleanup: function() {

View file

@ -285,7 +285,7 @@ var VIVE_CONTROLLER_CONFIGURATION = {
trigger: { trigger: {
position: { position: {
x: 0, x: 0.0055,
y: -0.023978, y: -0.023978,
z: 0.04546 z: 0.04546
}, },
@ -350,7 +350,7 @@ var VIVE_CONTROLLER_CONFIGURATION = {
annotations: { annotations: {
trigger: { trigger: {
position: { position: {
x: 0, x: -0.075,
y: -0.023978, y: -0.023978,
z: 0.04546 z: 0.04546
}, },
@ -400,7 +400,7 @@ var VIVE_CONTROLLER_CONFIGURATION = {
} }
var DEBUG = false; var DEBUG = false;
var VISIBLE_BY_DEFAULT = false; var VISIBLE_BY_DEFAULT = true;
function setupController(config) { function setupController(config) {
var controllerDisplay = { var controllerDisplay = {