This commit is contained in:
James B. Pollack 2016-03-18 14:52:34 -07:00
parent 0aab01d774
commit acba6817f2
4 changed files with 37 additions and 24 deletions

View file

@ -46,13 +46,16 @@
var UPPER_CORNER_FORWARD_OFFSET = -TANK_DIMENSIONS.x; var UPPER_CORNER_FORWARD_OFFSET = -TANK_DIMENSIONS.x;
var UPPER_CORNER_LATERAL_OFFSET = TANK_DIMENSIONS.z / 8; var UPPER_CORNER_LATERAL_OFFSET = TANK_DIMENSIONS.z / 8;
var upperCorner, lowerCorner;
function FishTank() { function FishTank() {
_this = this; _this = this;
} }
function startUpdate() { function startUpdate() {
upperCorner = getOffsetFromTankCenter(LOWER_CORNER_VERTICAL_OFFSET, LOWER_CORNER_FORWARD_OFFSET, LOWER_CORNER_LATERAL_OFFSET);
lowerCorner = getOffsetFromTankCenter(UPPER_CORNER_VERTICAL_OFFSET, UPPER_CORNER_FORWARD_OFFSET, UPPER_CORNER_LATERAL_OFFSET);
//when the baton is claimed; //when the baton is claimed;
// print('trying to claim the object' + _entityID) // print('trying to claim the object' + _entityID)
iOwn = true; iOwn = true;
@ -137,6 +140,7 @@
preload: function(entityID) { preload: function(entityID) {
// print("preload"); // print("preload");
this.entityID = entityID; this.entityID = entityID;
_entityID = entityID; _entityID = entityID;
this.initialize(entityID); this.initialize(entityID);
@ -409,7 +413,6 @@
} }
if (_this.userData['hifi-home-fishtank'].fishLoaded === false) { if (_this.userData['hifi-home-fishtank'].fishLoaded === false) {
//no fish in the user data //no fish in the user data
_this.tankLocked = true; _this.tankLocked = true;
@ -418,9 +421,7 @@
var data = { var data = {
fishLoaded: true, fishLoaded: true,
bubbleSystem: _this.userData['hifi-home-fishtank'].bubbleSystem, bubbleSystem: _this.userData['hifi-home-fishtank'].bubbleSystem,
bubbleSound: _this.userData['hifi-home-fishtank'].bubbleSound,
innerContainer: _this.userData['hifi-home-fishtank'].innerContainer, innerContainer: _this.userData['hifi-home-fishtank'].innerContainer,
} }
setEntityCustomData(FISHTANK_USERDATA_KEY, _this.entityID, data); setEntityCustomData(FISHTANK_USERDATA_KEY, _this.entityID, data);
_this.userData['hifi-home-fishtank'].fishLoaded = true; _this.userData['hifi-home-fishtank'].fishLoaded = true;
@ -497,6 +498,7 @@
z: 0 z: 0
}; };
var othersCounted = 0; var othersCounted = 0;
for (var j = 0; j < fish.length; j++) { for (var j = 0; j < fish.length; j++) {
if (i != j) { if (i != j) {
@ -604,8 +606,17 @@
var center = _this.currentProperties.position; var center = _this.currentProperties.position;
upperCorner = getOffsetFromTankCenter(LOWER_CORNER_VERTICAL_OFFSET, LOWER_CORNER_FORWARD_OFFSET, LOWER_CORNER_LATERAL_OFFSET); var lowerCorner = {
lowerCorner = getOffsetFromTankCenter(UPPER_CORNER_VERTICAL_OFFSET, UPPER_CORNER_FORWARD_OFFSET, UPPER_CORNER_LATERAL_OFFSET); x: center.x - (_this.currentProperties.dimensions.z / 2),
y: center.y,
z: center.z - (_this.currentProperties.dimensions.z / 2)
};
var upperCorner = {
x: center.x + (_this.currentProperties.dimensions.z / 2),
y: center.y + _this.currentProperties.dimensions.y,
z: center.z + (_this.currentProperties.dimensions.z / 2)
};
var fish = []; var fish = [];

View file

@ -124,12 +124,7 @@ FishTank = function(spawnPosition, spawnRotation) {
color: DEBUG_COLOR, color: DEBUG_COLOR,
collisionless: true, collisionless: true,
script: TANK_SCRIPT, script: TANK_SCRIPT,
visible: true, visible: true
userData: JSON.stringify({
'hifiHomeKey': {
'reset': true
}
}),
} }
if (spawnRotation !== undefined) { if (spawnRotation !== undefined) {
@ -427,18 +422,24 @@ FishTank = function(spawnPosition, spawnRotation) {
createTankBase(); createTankBase();
createTreasureChest(); createTreasureChest();
var customKey = 'hifi-home-fishtank';
var customKey = 'hifi-home-fishtank';
var data = { var data = {
fishLoaded: false, fishLoaded: false,
bubbleSystem: bubbleSystem, bubbleSystem: bubbleSystem,
// bubbleSound: bubbleSound,
innerContainer: innerContainer, innerContainer: innerContainer,
} }
var resetKey = 'hifiHomeKey';
var resetData = {
'reset': true
};
Script.setTimeout(function() { Script.setTimeout(function() {
setEntityCustomData(customKey, fishTank, data); setEntityCustomData(customKey, fishTank, data);
setEntityCustomData(resetKey, fishTank, resetData);
}, 2000) }, 2000)

View file

@ -114,6 +114,7 @@
dynamic: true, dynamic: true,
rotation: gunProperties.rotation, rotation: gunProperties.rotation,
position: this.getGunTipPosition(gunProperties), position: this.getGunTipPosition(gunProperties),
gravity:PING_PONG_GUN_GRAVITY,
velocity: forwardVec, velocity: forwardVec,
lifetime: 10, lifetime: 10,
userData: JSON.stringify({ userData: JSON.stringify({

View file

@ -34,7 +34,7 @@
Script.include(kineticPath); Script.include(kineticPath);
Script.include(utilsPath); Script.include(utilsPath);
// Script.include(fishTankPath); Script.include(fishTankPath);
Script.include(tiltMazePath); Script.include(tiltMazePath);
Script.include(whiteboardPath); Script.include(whiteboardPath);
Script.include(plantPath); Script.include(plantPath);
@ -113,15 +113,15 @@
createDynamicEntities: function() { createDynamicEntities: function() {
// var fishTank = new FishTank({ var fishTank = new FishTank({
// x: 1098.9254, x: 1098.9254,
// y: 460.5814, y: 460.5814,
// z: -79.1103 z: -79.1103
// }, { }, {
// x: 0, x: 0,
// y: 152, y: 152,
// z: 0 z: 0
// }); });
var tiltMaze = new TiltMaze({ var tiltMaze = new TiltMaze({
x: 1105.5768, x: 1105.5768,