Make adjustments to tutorial

This commit is contained in:
Ryan Huffman 2016-09-02 09:01:50 -07:00
parent e8a1f50aee
commit f4f2ec5da8
2 changed files with 22 additions and 16 deletions

View file

@ -239,6 +239,7 @@ var stepDisableControllers = function(name) {
} }
stepDisableControllers.prototype = { stepDisableControllers.prototype = {
start: function(onFinish) { start: function(onFinish) {
editEntitiesWithTag('door', { visible: true });
Menu.setIsOptionChecked("Overlays", false); Menu.setIsOptionChecked("Overlays", false);
Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'both'); Messages.sendLocalMessage('Hifi-Teleport-Disabler', 'both');
Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({ Messages.sendLocalMessage('Hifi-Grab-Disable', JSON.stringify({
@ -341,22 +342,26 @@ stepNearGrab.prototype = {
var basketColliderID = findEntity({ name: NEAR_BASKET_COLLIDER_NAME }, 10000); var basketColliderID = findEntity({ name: NEAR_BASKET_COLLIDER_NAME }, 10000);
var basketPosition = Entities.getEntityProperties(basketColliderID, 'position').position; var basketPosition = Entities.getEntityProperties(basketColliderID, 'position').position;
var boxSpawnID = findEntity({ name: NEAR_BOX_SPAWN_NAME }, 10000);
if (!boxSpawnID) {
print("Error creating block, cannot find spawn");
return null;
}
var boxSpawnPosition = Entities.getEntityProperties(boxSpawnID, 'position').position;
function createBlock() { function createBlock() {
var boxSpawnID = findEntity({ name: NEAR_BOX_SPAWN_NAME }, 10000); Step1BlockData.position = boxSpawnPosition;
if (!boxSpawnID) {
print("Error creating block, cannot find spawn");
return null;
}
Step1BlockData.position = Entities.getEntityProperties(boxSpawnID, 'position').position;
return spawnWithTag([Step1BlockData], null, this.tempTag)[0]; return spawnWithTag([Step1BlockData], null, this.tempTag)[0];
} }
// Enabled grab // Enabled grab
// Create table ? // Create table ?
// Create blocks and basket // Create blocks and basket
var boxID = createBlock.bind(this)(); this.boxID = createBlock.bind(this)();
print("Created", boxID); print("Created", this.boxID);
//function posChecker() {
//Vec3.distance(
//}
function onHit() { function onHit() {
onFinish(); onFinish();
@ -365,7 +370,7 @@ stepNearGrab.prototype = {
// When block collides with basket start step 2 // When block collides with basket start step 2
function checkCollides() { function checkCollides() {
print(this.tag, "CHECKING..."); print(this.tag, "CHECKING...");
if (Vec3.distance(basketPosition, Entities.getEntityProperties(boxID, 'position').position) < 0.1) { if (Vec3.distance(basketPosition, Entities.getEntityProperties(this.boxID, 'position').position) < 0.1) {
Script.clearInterval(this.checkCollidesTimer); Script.clearInterval(this.checkCollidesTimer);
this.checkCollidesTimer = null; this.checkCollidesTimer = null;
this.soundInjector = Audio.playSound(successSound, { this.soundInjector = Audio.playSound(successSound, {
@ -435,8 +440,8 @@ stepFarGrab.prototype = {
// Enabled grab // Enabled grab
// Create table ? // Create table ?
// Create blocks and basket // Create blocks and basket
var boxID = createBlock.bind(this)(); this.boxID = createBlock.bind(this)();
print("Created", boxID); print("Created", this.boxID);
function onHit() { function onHit() {
onFinish(); onFinish();
@ -446,7 +451,7 @@ stepFarGrab.prototype = {
var checkCollidesTimer = null; var checkCollidesTimer = null;
function checkCollides() { function checkCollides() {
print("CHECKING..."); print("CHECKING...");
if (Vec3.distance(basketPosition, Entities.getEntityProperties(boxID, 'position').position) < 0.1) { if (Vec3.distance(basketPosition, Entities.getEntityProperties(this.boxID, 'position').position) < 0.1) {
Script.clearInterval(checkCollidesTimer); Script.clearInterval(checkCollidesTimer);
this.soundInjector = Audio.playSound(successSound, { this.soundInjector = Audio.playSound(successSound, {
position: basketPosition, position: basketPosition,
@ -548,7 +553,7 @@ stepEquip.prototype = {
print("CHECKING FOR PING PONG..."); print("CHECKING FOR PING PONG...");
var ammoIDs = findEntities({ name: GUN_AMMO_NAME }, 15); var ammoIDs = findEntities({ name: GUN_AMMO_NAME }, 15);
for (var i = 0; i < ammoIDs.length; ++i) { for (var i = 0; i < ammoIDs.length; ++i) {
if (Vec3.distance(basketPosition, Entities.getEntityProperties(ammoIDs[i], 'position').position) < 0.2) { if (Vec3.distance(basketPosition, Entities.getEntityProperties(ammoIDs[i], 'position').position) < 0.25) {
Script.clearInterval(this.checkCollidesTimer); Script.clearInterval(this.checkCollidesTimer);
this.checkCollidesTimer = null; this.checkCollidesTimer = null;
this.soundInjector = Audio.playSound(successSound, { this.soundInjector = Audio.playSound(successSound, {
@ -561,7 +566,7 @@ stepEquip.prototype = {
} }
} }
} }
this.checkCollidesTimer = Script.setInterval(checkCollides.bind(this), 500); this.checkCollidesTimer = Script.setInterval(checkCollides.bind(this), 100);
// 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
}, },
@ -718,6 +723,7 @@ var stepFinish = function(name) {
} }
stepFinish.prototype = { stepFinish.prototype = {
start: function(onFinish) { start: function(onFinish) {
editEntitiesWithTag('door', { visible: false });
Menu.setIsOptionChecked("Overlays", true); Menu.setIsOptionChecked("Overlays", true);
showEntitiesWithTag(this.tag); showEntitiesWithTag(this.tag);
}, },

View file

@ -400,7 +400,7 @@ var VIVE_CONTROLLER_CONFIGURATION = {
} }
var DEBUG = false; var DEBUG = false;
var VISIBLE_BY_DEFAULT = true; var VISIBLE_BY_DEFAULT = false;
function setupController(config) { function setupController(config) {
var controllerDisplay = { var controllerDisplay = {