Merge pull request #5757 from ZappoMan/breakdanceToy

added some debugging to breakdance toy
This commit is contained in:
Brad Hefta-Gaub 2015-09-09 14:56:08 -07:00
commit 0023016447

View file

@ -31,6 +31,7 @@
// if we're currently being grabbed and if the person grabbing us is the current interfaces avatar. // if we're currently being grabbed and if the person grabbing us is the current interfaces avatar.
// we will watch this for state changes and print out if we're being grabbed or released when it changes. // we will watch this for state changes and print out if we're being grabbed or released when it changes.
update: function() { update: function() {
//print("BreakdanceEntity.update() _this.entityID:" + _this.entityID);
var GRAB_USER_DATA_KEY = "grabKey"; var GRAB_USER_DATA_KEY = "grabKey";
// because the update() signal doesn't have a valid this, we need to use our memorized _this to access our entityID // because the update() signal doesn't have a valid this, we need to use our memorized _this to access our entityID
@ -45,14 +46,15 @@
// if the grabData says we're being grabbed, and the owner ID is our session, then we are being grabbed by this interface // if the grabData says we're being grabbed, and the owner ID is our session, then we are being grabbed by this interface
if (grabData.activated && grabData.avatarId == MyAvatar.sessionUUID) { if (grabData.activated && grabData.avatarId == MyAvatar.sessionUUID) {
//print("BreakdanceEntity.update() [I'm being grabbed] _this.entityID:" + _this.entityID);
if (!_this.beingGrabbed) { if (!_this.beingGrabbed) {
print("I'm was grabbed... _this.entityID:" + _this.entityID);
// remember we're being grabbed so we can detect being released // remember we're being grabbed so we can detect being released
_this.beingGrabbed = true; _this.beingGrabbed = true;
var props = Entities.getEntityProperties(entityID); var props = Entities.getEntityProperties(entityID);
var puppetPosition = getPuppetPosition(props); var puppetPosition = getPuppetPosition(props);
breakdanceStart(props.modelURL, puppetPosition); breakdanceStart(props.modelURL, puppetPosition);
print("I'm was grabbed...");
} else { } else {
breakdanceUpdate(); breakdanceUpdate();
} }
@ -62,7 +64,7 @@
// if we are not being grabbed, and we previously were, then we were just released, remember that // if we are not being grabbed, and we previously were, then we were just released, remember that
// and print out a message // and print out a message
_this.beingGrabbed = false; _this.beingGrabbed = false;
print("I'm was released..."); print("I'm was released... _this.entityID:" + _this.entityID);
breakdanceEnd(); breakdanceEnd();
} }
}, },
@ -73,6 +75,7 @@
// * connecting to the update signal so we can check our grabbed state // * connecting to the update signal so we can check our grabbed state
preload: function(entityID) { preload: function(entityID) {
this.entityID = entityID; this.entityID = entityID;
print("BreakdanceEntity.preload() this.entityID:" + this.entityID);
Script.update.connect(this.update); Script.update.connect(this.update);
}, },
@ -80,6 +83,7 @@
// or because we've left the domain or quit the application. In all cases we want to unhook our connection // or because we've left the domain or quit the application. In all cases we want to unhook our connection
// to the update signal // to the update signal
unload: function(entityID) { unload: function(entityID) {
print("BreakdanceEntity.unload() this.entityID:" + this.entityID);
Script.update.disconnect(this.update); Script.update.disconnect(this.update);
}, },