mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
tidyyy guy!
This commit is contained in:
parent
2c8f13b538
commit
8877a6c570
3 changed files with 46 additions and 22 deletions
|
@ -10,19 +10,20 @@ var SCRIPT_URL = Script.resolvePath('reset.js?' + Math.random());
|
|||
function createTidyGuy() {
|
||||
var properties = {
|
||||
type: 'Model',
|
||||
modelURL: 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-4.fbx',
|
||||
modelURL: 'http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx',
|
||||
dimensions: {
|
||||
x: 0.32,
|
||||
y: 0.96,
|
||||
z: 0.6844
|
||||
},
|
||||
position: center,
|
||||
// color:{
|
||||
// red:0,
|
||||
// green:255,
|
||||
// blue:0
|
||||
// },
|
||||
script: SCRIPT_URL
|
||||
script: SCRIPT_URL,
|
||||
dynamic:false,
|
||||
userData:JSON.stringify({
|
||||
grabbableKey:{
|
||||
wantsTrigger:true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return Entities.addEntity(properties);
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
// This entity script handles the logic for growing a plant when it has water poured on it
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
var PLANT_SCRIPT_URL = Script.resolvePath("growingPlant/growingPlantEntityScript.js?v1" + Math.random().toFixed(2));
|
||||
var WATER_CAN_SCRIPT_URL = Script.resolvePath("growingPlant/waterCanEntityScript.js?v2" + Math.random().toFixed());
|
||||
Plant = function(spawnPosition, spawnRotation) {
|
||||
var orientation = Camera.getOrientation();
|
||||
orientation = Quat.safeEulerAngles(orientation);
|
||||
|
@ -35,7 +36,7 @@ Plant = function(spawnPosition, spawnRotation) {
|
|||
|
||||
|
||||
var PLANT_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/Flowers--Moss-Rock.fbx";
|
||||
var PLANT_SCRIPT_URL = Script.resolvePath("growingPlant/growingPlantEntityScript.js?v1" + Math.random().toFixed(2));
|
||||
|
||||
var plantDimensions = {
|
||||
x: 0.52,
|
||||
y: 0.2600,
|
||||
|
@ -57,7 +58,7 @@ Plant = function(spawnPosition, spawnRotation) {
|
|||
});
|
||||
|
||||
var WATER_CAN_MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/waterCan.fbx?v1" + Math.random();
|
||||
var WATER_CAN_SCRIPT_URL = Script.resolvePath("growingPlant/waterCanEntityScript.js?v2" + Math.random().toFixed());
|
||||
|
||||
var waterCanPosition = Vec3.sum(plantPosition, Vec3.multiply(0.6, Quat.getRight(orientation)));
|
||||
var waterCanRotation = orientation;
|
||||
var waterCan = Entities.addEntity({
|
||||
|
|
|
@ -31,38 +31,60 @@
|
|||
var plantPath = Script.resolvePath("growingPlant/wrapper.js?" + Math.random());
|
||||
|
||||
Reset.prototype = {
|
||||
preload: function() {
|
||||
|
||||
preload: function(entityID) {
|
||||
_this.entityID = entityID;
|
||||
},
|
||||
unload: function() {
|
||||
|
||||
this.cleanupDynamicEntities();
|
||||
},
|
||||
tidying: false,
|
||||
showTidyingButton: function() {
|
||||
var textureString =
|
||||
'Texture.001:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Head-Housing-Texture.png",\ntex.face.screen.emit:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/tidy-guy-face-Emit.png",\ntex.face.sceen:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/tidy-guy-face.png",\ntex.button.blanks:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Button-Blanks.png",\ntex.button.blanks.normal:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Button-Blanks-Normal.png",\nbutton.tidy.emit:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidy-Up-Button-Orange-Emit.png",\nbutton.tidy:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidy-Up-Button-Orange.png"'
|
||||
|
||||
Entities.editEntity(_this.entityID, {
|
||||
textures: textureString
|
||||
});
|
||||
},
|
||||
showTidyButton: function() {
|
||||
var textureString =
|
||||
'Texture.001:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Head-Housing-Texture.png",\ntex.face.screen.emit:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/tidy-guy-face-Emit.png",\ntex.face.sceen:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/tidy-guy-face.png",\ntex.button.blanks:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Button-Blanks.png",\ntex.button.blanks.normal:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Button-Blanks-Normal.png",\nbutton.tidy.emit:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Tidy-Up-Button-Green-Emit.png",\nbutton.tidy:"http://hifi-content.s3.amazonaws.com/DomainContent/Home/tidyGuy/Tidyguy-6.fbx/Tidyguy-6.fbm/Tidy-Up-Button-Green.png"'
|
||||
|
||||
Entities.editEntity(_this.entityID, {
|
||||
textures: textureString
|
||||
});
|
||||
},
|
||||
playTidyingSound: function() {
|
||||
|
||||
},
|
||||
toggleButton: function() {
|
||||
|
||||
if (_this.tidying === true) {
|
||||
return;
|
||||
} else {
|
||||
_this.tidying = true;
|
||||
_this.showTidyingButton();
|
||||
_this.playTidyingSound();
|
||||
Script.setTimeout(function() {
|
||||
_this.showTidyButton();
|
||||
_this.tidying = false;
|
||||
}, 2500);
|
||||
_this.cleanupDynamicEntities();
|
||||
_this.createDynamicEntities();
|
||||
}
|
||||
},
|
||||
|
||||
clickReleaseOnEntity: function(entityID, mouseEvent) {
|
||||
if (!mouseEvent.isLeftButton) {
|
||||
return;
|
||||
}
|
||||
_this.prepareScene();
|
||||
print('CLICK ON TIDY GUY!!!')
|
||||
_this.toggleButton();
|
||||
|
||||
},
|
||||
prepareScene: function() {
|
||||
_this.cleanupDynamicEntities();
|
||||
_this.createDynamicEntities();
|
||||
},
|
||||
|
||||
startNearTrigger: function() {
|
||||
_this.prepareScene();
|
||||
_this.toggleButton();
|
||||
},
|
||||
|
||||
createDynamicEntities: function() {
|
||||
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||
x: 0,
|
||||
|
@ -92,11 +114,11 @@
|
|||
// var cuckooClock = new CuckooClock();
|
||||
// var doppelganger = new Doppelganger();
|
||||
},
|
||||
|
||||
cleanupDynamicEntities: function() {
|
||||
if (dynamicEntities.length === 0) {
|
||||
return;
|
||||
}
|
||||
print('DYNAMIC ENTITIES:: ' + JSON.stringify(dynamicEntities))
|
||||
dynamicEntities.forEach(function(dynamicEntity) {
|
||||
dynamicEntity.cleanup();
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue