mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:36:47 +02:00
tidy 2.0
This commit is contained in:
parent
e92b4029b2
commit
d1d0bbdd26
1 changed files with 124 additions and 23 deletions
|
@ -66,26 +66,40 @@
|
||||||
|
|
||||||
var TRANSFORMER_URL_MATTHEW = 'atp:/dressingRoom/matthew.fbx';
|
var TRANSFORMER_URL_MATTHEW = 'atp:/dressingRoom/matthew.fbx';
|
||||||
|
|
||||||
|
var BEAM_TRIGGER_THRESHOLD = 0.075;
|
||||||
|
|
||||||
|
var BEAM_POSITION = {
|
||||||
|
x: 1103.3876,
|
||||||
|
y: 460.4591,
|
||||||
|
z: -74.2998
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reset.prototype = {
|
Reset.prototype = {
|
||||||
tidying: false,
|
tidying: false,
|
||||||
|
eyesOn: false,
|
||||||
|
flickerInterval: null,
|
||||||
preload: function(entityID) {
|
preload: function(entityID) {
|
||||||
_this.entityID = entityID;
|
_this.entityID = entityID;
|
||||||
|
_this.tidySound = SoundCache.getSound("atp:/sounds/tidy.wav");
|
||||||
|
Script.update.connect(_this.update);
|
||||||
},
|
},
|
||||||
|
|
||||||
showTidyingButton: function() {
|
showTidyingButton: function() {
|
||||||
var data = {
|
var data = {
|
||||||
"Texture.001": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/Head-Housing-Texture.png",
|
"Texture": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Tidy-Swipe-Sticker.jpg",
|
||||||
"button.tidy": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/Tidy-Up-Button-Orange.png",
|
"Texture.001": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Head-Housing-Texture.png",
|
||||||
"button.tidy-active": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/Tidy-Up-Button-Orange.png",
|
"Texture.003": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Tidy-Swipe-Sticker-Emit.jpg",
|
||||||
"button.tidy-active.emit": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/Tidy-Up-Button-Orange-Emit.png",
|
"tex.button.blanks": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Button-Blanks.png",
|
||||||
"button.tidy.emit": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/Tidy-Up-Button-Orange-Emit.png",
|
"tex.button.blanks.normal": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Button-Blanks-Normal.png",
|
||||||
"tex.button.blanks": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/Button-Blanks.png",
|
"tex.face.sceen.default": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/face-default.jpg",
|
||||||
"tex.button.blanks.normal": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/Button-Blanks-Normal.png",
|
"tex.face.screen-active": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/face-active.jpg",
|
||||||
"tex.face.sceen": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/tidy-guy-face.png",
|
"tex.glow.active": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/glow-active.png",
|
||||||
"tex.face.screen.emit": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/tidy-guy-face-Emit.png"
|
"tex.glow.default": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/glow-active.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Entities.editEntity(_this.entityID, {
|
Entities.editEntity(_this.entityID, {
|
||||||
textures: JSON.stringify(data)
|
textures: JSON.stringify(data)
|
||||||
});
|
});
|
||||||
|
@ -93,13 +107,15 @@
|
||||||
|
|
||||||
showTidyButton: function() {
|
showTidyButton: function() {
|
||||||
var data = {
|
var data = {
|
||||||
"Texture.001": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/Head-Housing-Texture.png",
|
"Texture": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Tidy-Swipe-Sticker.jpg",
|
||||||
"button.tidy": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/Tidy-Up-Button-Green.png",
|
"Texture.001": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Head-Housing-Texture.png",
|
||||||
"button.tidy.emit": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/Tidy-Up-Button-Green-Emit.png",
|
"Texture.003": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Tidy-Swipe-Sticker-Emit.jpg",
|
||||||
"tex.button.blanks": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/Button-Blanks.png",
|
"tex.button.blanks": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Button-Blanks.png",
|
||||||
"tex.button.blanks.normal": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/Button-Blanks-Normal.png",
|
"tex.button.blanks.normal": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Button-Blanks-Normal.png",
|
||||||
"tex.face.sceen": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/tidy-guy-face.png",
|
"tex.face.sceen.default": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/face-default.jpg",
|
||||||
"tex.face.screen.emit": "atp:/Tidyguy-7.fbx/Tidyguy-7.fbm/tidy-guy-face-Emit.png"
|
"tex.face.screen-active": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/face-active.jpg",
|
||||||
|
"tex.glow.active": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/glow-active.png",
|
||||||
|
"tex.glow.default": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/glow-default.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,6 +125,18 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
playTidyingSound: function() {
|
playTidyingSound: function() {
|
||||||
|
var location = {
|
||||||
|
x: 1102.7660,
|
||||||
|
y: 460.9814,
|
||||||
|
z: -78.6451
|
||||||
|
}
|
||||||
|
|
||||||
|
var injector = Audio.playSound(_this.tidySound, {
|
||||||
|
volume: 1,
|
||||||
|
position: location
|
||||||
|
});
|
||||||
|
|
||||||
|
print('INJECTOR IS: ' + injector)
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -119,7 +147,7 @@
|
||||||
_this.tidying = true;
|
_this.tidying = true;
|
||||||
_this.showTidyingButton();
|
_this.showTidyingButton();
|
||||||
_this.playTidyingSound();
|
_this.playTidyingSound();
|
||||||
|
_this.flickerEyes();
|
||||||
_this.findAndDeleteHomeEntities();
|
_this.findAndDeleteHomeEntities();
|
||||||
Script.setTimeout(function() {
|
Script.setTimeout(function() {
|
||||||
_this.showTidyButton();
|
_this.showTidyButton();
|
||||||
|
@ -130,12 +158,64 @@
|
||||||
_this.createKineticEntities();
|
_this.createKineticEntities();
|
||||||
_this.createScriptedEntities();
|
_this.createScriptedEntities();
|
||||||
_this.setupDressingRoom();
|
_this.setupDressingRoom();
|
||||||
}, 750)
|
}, 750);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
flickerEyes: function() {
|
||||||
|
|
||||||
|
this.flickerInterval = Script.setInterval(function() {
|
||||||
|
if (_this.eyesOn === true) {
|
||||||
|
_this.turnEyesOff();
|
||||||
|
_this.eyesOn = false;
|
||||||
|
} else if (_this.eyesOn === false) {
|
||||||
|
_this.turnEyesOn();
|
||||||
|
_this.eyesOn = true
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
Script.clearInterval(_this.flickerInterval);
|
||||||
|
}, 2500)
|
||||||
|
},
|
||||||
|
|
||||||
|
turnEyesOn: function() {
|
||||||
|
var data = {
|
||||||
|
"Texture": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Tidy-Swipe-Sticker.jpg",
|
||||||
|
"Texture.001": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Head-Housing-Texture.png",
|
||||||
|
"Texture.003": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Tidy-Swipe-Sticker-Emit.jpg",
|
||||||
|
"tex.button.blanks": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Button-Blanks.png",
|
||||||
|
"tex.button.blanks.normal": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Button-Blanks-Normal.png",
|
||||||
|
"tex.face.sceen.default": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/face-active.jpg",
|
||||||
|
"tex.face.screen-active": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/face-active.jpg",
|
||||||
|
"tex.glow.active": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/glow-active.png",
|
||||||
|
"tex.glow.default": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/glow-active.png"
|
||||||
|
};
|
||||||
|
|
||||||
|
Entities.editEntity(_this.entityID, {
|
||||||
|
textures: JSON.stringify(data)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
turnEyesOff: function() {
|
||||||
|
var data = {
|
||||||
|
"Texture": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Tidy-Swipe-Sticker.jpg",
|
||||||
|
"Texture.001": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Head-Housing-Texture.png",
|
||||||
|
"Texture.003": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Tidy-Swipe-Sticker-Emit.jpg",
|
||||||
|
"tex.button.blanks": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Button-Blanks.png",
|
||||||
|
"tex.button.blanks.normal": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/Button-Blanks-Normal.png",
|
||||||
|
"tex.face.sceen.default": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/face-default.jpg",
|
||||||
|
"tex.face.screen-active": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/face-active.jpg",
|
||||||
|
"tex.glow.active": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/glow-active.png",
|
||||||
|
"tex.glow.default": "atp:/Tidyguy-4d.fbx/Tidyguy-4d.fbm/glow-active.png"
|
||||||
|
};
|
||||||
|
|
||||||
|
Entities.editEntity(_this.entityID, {
|
||||||
|
textures: JSON.stringify(data)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
clickReleaseOnEntity: function(entityID, mouseEvent) {
|
clickReleaseOnEntity: function(entityID, mouseEvent) {
|
||||||
if (!mouseEvent.isLeftButton) {
|
if (!mouseEvent.isLeftButton) {
|
||||||
return;
|
return;
|
||||||
|
@ -144,9 +224,9 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
startNearTrigger: function() {
|
// startNearTrigger: function() {
|
||||||
_this.toggleButton();
|
// _this.toggleButton();
|
||||||
},
|
// },
|
||||||
|
|
||||||
findAndDeleteHomeEntities: function() {
|
findAndDeleteHomeEntities: function() {
|
||||||
print('HOME trying to find home entities to delete')
|
print('HOME trying to find home entities to delete')
|
||||||
|
@ -479,7 +559,28 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
update: function() {
|
||||||
|
if (_this.tidying === true) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var leftHandPosition = MyAvatar.getLeftPalmPosition();
|
||||||
|
var rightHandPosition = MyAvatar.getRightPalmPosition();
|
||||||
|
|
||||||
|
var rightDistance = Vec3.distance(leftHandPosition, BEAM_POSITION)
|
||||||
|
var leftDistance = Vec3.distance(leftHandPosition, BEAM_POSITION)
|
||||||
|
|
||||||
|
if (rightDistance < BEAM_TRIGGER_THRESHOLD || leftDistance < BEAM_TRIGGER_THRESHOLD) {
|
||||||
|
_this.toggleButton();
|
||||||
|
} else {
|
||||||
|
//too far to toggle swipe
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
unload: function() {
|
unload: function() {
|
||||||
|
Script.update.disconnect(_this.update);
|
||||||
|
|
||||||
|
Script.clearInterval(_this.flickerInterval);
|
||||||
// this.findAndDeleteHomeEntities();
|
// this.findAndDeleteHomeEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue