mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 16:55:07 +02:00
Add extra logging to tutorial zones
This commit is contained in:
parent
09d9cd8311
commit
504295cdcf
2 changed files with 36 additions and 19 deletions
|
@ -1,28 +1,42 @@
|
|||
(function() {
|
||||
var TutorialStartZone = function() {
|
||||
print("TutorialStartZone | Creating");
|
||||
};
|
||||
|
||||
TutorialStartZone.prototype = {
|
||||
preload: function(entityID) {
|
||||
print("TutorialStartZone | Preload");
|
||||
this.entityID = entityID;
|
||||
this.sendStartIntervalID = null;
|
||||
},
|
||||
enterEntity: function() {
|
||||
var self = this;
|
||||
// send message to outer zone
|
||||
print("Entered the tutorial start area");
|
||||
print("TutorialStartZone | Entered the tutorial start area");
|
||||
if (HMD.isHMDAvailable() && HMD.isHandControllerAvailable()) {
|
||||
var parentID = Entities.getEntityProperties(this.entityID, 'parentID').parentID;
|
||||
if (parentID) {
|
||||
Entities.callEntityMethod(parentID, 'start');
|
||||
} else {
|
||||
print("ERROR: No parent id found on tutorial start zone");
|
||||
function sendStart() {
|
||||
print("TutorialStartZone | Checking parent ID");
|
||||
var parentID = Entities.getEntityProperties(self.entityID, 'parentID').parentID;
|
||||
print("TutorialStartZone | Parent ID is: ", parentID);
|
||||
if (parentID) {
|
||||
print("TutorialStartZone | Entered the tutorial start area");
|
||||
Entities.callEntityMethod(parentID, 'start');
|
||||
} else {
|
||||
print("TutorialStartZone | ERROR: No parent id found on tutorial start zone");
|
||||
}
|
||||
}
|
||||
this.sendStartIntervalID = Script.setInterval(sendStart, 1500);
|
||||
} else {
|
||||
print("TutorialStartZone | User tried to go to tutorial with HMD and hand controllers, sending back to /");
|
||||
Window.alert("To proceed with this tutorial, please connect your VR headset and hand controllers.");
|
||||
location = "/";
|
||||
}
|
||||
},
|
||||
leaveEntity: function() {
|
||||
print("Exited the tutorial start area");
|
||||
print("TutorialStartZone | Exited the tutorial start area");
|
||||
if (this.sendStartIntervalID) {
|
||||
Script.clearInterval(this.sendStartIntervalID);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ if (!Function.prototype.bind) {
|
|||
Script.include(tutorialPath);
|
||||
|
||||
var TutorialZone = function() {
|
||||
print("TutorialZone | Creating");
|
||||
this.token = null;
|
||||
};
|
||||
|
||||
|
@ -55,34 +56,36 @@ if (!Function.prototype.bind) {
|
|||
}
|
||||
},
|
||||
preload: function(entityID) {
|
||||
print("TutorialZone | Preload");
|
||||
this.entityID = entityID;
|
||||
},
|
||||
start: function() {
|
||||
print("Got start");
|
||||
print("TutorialZone | Got start");
|
||||
var self = this;
|
||||
if (!this.token) {
|
||||
print("TutorialZone | Creating token");
|
||||
this.token = new OwnershipToken(Math.random() * 100000, this.entityID, {
|
||||
onGainedOwnership: function(token) {
|
||||
print("GOT OWNERSHIP");
|
||||
print("TutorialZone | GOT OWNERSHIP");
|
||||
if (!self.tutorialManager) {
|
||||
self.tutorialManager = new TutorialManager();
|
||||
}
|
||||
self.tutorialManager.startTutorial();
|
||||
print("making bound release handler");
|
||||
print("TutorialZone | making bound release handler");
|
||||
self.keyReleaseHandlerBound = self.keyReleaseHandler.bind(self);
|
||||
print("binding");
|
||||
print("TutorialZone | binding");
|
||||
Controller.keyReleaseEvent.connect(self.keyReleaseHandlerBound);
|
||||
print("done");
|
||||
print("TutorialZone | done");
|
||||
},
|
||||
onLostOwnership: function(token) {
|
||||
print("LOST OWNERSHIP");
|
||||
print("TutorialZone | LOST OWNERSHIP");
|
||||
if (self.tutorialManager) {
|
||||
print("stopping tutorial..");
|
||||
print("TutorialZone | stopping tutorial..");
|
||||
self.tutorialManager.stopTutorial();
|
||||
print("done");
|
||||
print("TutorialZone | done");
|
||||
Controller.keyReleaseEvent.disconnect(self.keyReleaseHandlerBound);
|
||||
} else {
|
||||
print("no tutorial manager...");
|
||||
print("TutorialZone | no tutorial manager...");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -90,12 +93,12 @@ if (!Function.prototype.bind) {
|
|||
},
|
||||
|
||||
enterEntity: function() {
|
||||
print("ENTERED THE TUTORIAL AREA");
|
||||
print("TutorialZone | ENTERED THE TUTORIAL AREA");
|
||||
},
|
||||
leaveEntity: function() {
|
||||
print("EXITED THE TUTORIAL AREA");
|
||||
print("TutorialZone | EXITED THE TUTORIAL AREA");
|
||||
if (this.token) {
|
||||
print("destroying token");
|
||||
print("TutorialZone | Destroying token");
|
||||
this.token.destroy();
|
||||
this.token = null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue