mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 17:44:15 +02:00
dressing room and tilt maze thangs
This commit is contained in:
parent
3f6b7c2f1c
commit
cb1f5e3e4f
3 changed files with 35 additions and 13 deletions
|
@ -28,16 +28,7 @@
|
||||||
var otherProps = Entities.getEntityProperties(otherID);
|
var otherProps = Entities.getEntityProperties(otherID);
|
||||||
|
|
||||||
if (otherProps.name === "hifi-home-dressing-room-transformer-collider" && _this.locked === false) {
|
if (otherProps.name === "hifi-home-dressing-room-transformer-collider" && _this.locked === false) {
|
||||||
var myProps = Entities.getEntityProperties(myID);
|
_this.findRotatorBlock();
|
||||||
var distance = Vec3.distance(myProps.position, otherProps.position);
|
|
||||||
if (distance < TRIGGER_DISTANCE) {
|
|
||||||
print('transformer should do magic!!!')
|
|
||||||
// this.playTransformationSound(collisionInfo.contactPoint);
|
|
||||||
// this.createTransformationParticles();
|
|
||||||
_this.findRotatorBlock();
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.locked = true;
|
this.locked = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -75,11 +66,19 @@
|
||||||
|
|
||||||
removeCurrentBigVersion: function(rotatorBlock) {
|
removeCurrentBigVersion: function(rotatorBlock) {
|
||||||
print('transformer should remove big version')
|
print('transformer should remove big version')
|
||||||
|
var blacklistKey = 'Hifi-Hand-RayPick-Blacklist';
|
||||||
|
|
||||||
|
|
||||||
var myProps = Entities.getEntityProperties(_this.entityID);
|
var myProps = Entities.getEntityProperties(_this.entityID);
|
||||||
var results = Entities.findEntities(myProps.position, 10);
|
var results = Entities.findEntities(myProps.position, 10);
|
||||||
results.forEach(function(result) {
|
results.forEach(function(result) {
|
||||||
var resultProps = Entities.getEntityProperties(result);
|
var resultProps = Entities.getEntityProperties(result);
|
||||||
if (resultProps.name === "hifi-home-dressing-room-big-transformer") {
|
if (resultProps.name === "hifi-home-dressing-room-big-transformer") {
|
||||||
|
Messages.sendMessage(blacklistKey, JSON.stringify({
|
||||||
|
action: 'remove',
|
||||||
|
id: result
|
||||||
|
}));
|
||||||
|
|
||||||
Entities.deleteEntity(result);
|
Entities.deleteEntity(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -89,6 +88,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
createBigVersion: function(smallProps) {
|
createBigVersion: function(smallProps) {
|
||||||
|
|
||||||
print('transformer should create big version!!')
|
print('transformer should create big version!!')
|
||||||
print('transformer has rotatorBlock??' + _this.rotatorBlock);
|
print('transformer has rotatorBlock??' + _this.rotatorBlock);
|
||||||
var rotatorProps = Entities.getEntityProperties(_this.rotatorBlock);
|
var rotatorProps = Entities.getEntityProperties(_this.rotatorBlock);
|
||||||
|
@ -110,12 +110,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var bigVersion = Entities.addEntity(bigVersionProps);
|
var bigVersion = Entities.addEntity(bigVersionProps);
|
||||||
print('transformer created big version: ' + bigVersion)
|
print('transformer created big version: ' + bigVersion);
|
||||||
|
|
||||||
|
var blacklistKey = 'Hifi-Hand-RayPick-Blacklist';
|
||||||
|
Messages.sendMessage(blacklistKey, JSON.stringify({
|
||||||
|
action: 'add',
|
||||||
|
id: bigVersion
|
||||||
|
}));
|
||||||
|
|
||||||
_this.putNewVersionOnShelf();
|
_this.putNewVersionOnShelf();
|
||||||
},
|
},
|
||||||
|
|
||||||
putTransformerOnRotatorBlock: function(blockPosition) {
|
putTransformerOnRotatorBlock: function(blockPosition) {
|
||||||
print('transformer should get set on rotator block')
|
print('transformer should get set on rotator block')
|
||||||
|
|
||||||
|
blockPosition.y = blockPosition.y + 1;
|
||||||
|
// var newPosition = {
|
||||||
|
// x:blockPosition.x,
|
||||||
|
// y:blockPosition.y+1,
|
||||||
|
// z:blockPosition
|
||||||
|
// };
|
||||||
return blockPosition
|
return blockPosition
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
},
|
},
|
||||||
visible: true,
|
visible: true,
|
||||||
damping: 0.8,
|
damping: 0.8,
|
||||||
|
angularDamping:0.8,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
'grabbableKey': {
|
'grabbableKey': {
|
||||||
'grabbable': true
|
'grabbable': true
|
||||||
|
@ -32,6 +33,7 @@
|
||||||
'reset': true
|
'reset': true
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
density:5000,
|
||||||
dimensions: dimensions,
|
dimensions: dimensions,
|
||||||
script: TRANSFORMER_SCRIPT
|
script: TRANSFORMER_SCRIPT
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
preload: function(entityID) {
|
preload: function(entityID) {
|
||||||
this.entityID = entityID;
|
this.entityID = entityID;
|
||||||
VICTORY_SOUND = SoundCache.getSound("http://hifi-content.s3.amazonaws.com/DomainContent/Home/tiltMaze/levelUp.wav");
|
VICTORY_SOUND = SoundCache.getSound("http://hifi-content.s3.amazonaws.com/DomainContent/Home/tiltMaze/levelUp.wav");
|
||||||
|
Script.update.connect(this.update);
|
||||||
},
|
},
|
||||||
startNearGrab: function() {
|
startNearGrab: function() {
|
||||||
//check to make sure a ball is in range, otherwise create one
|
//check to make sure a ball is in range, otherwise create one
|
||||||
|
@ -165,6 +166,7 @@
|
||||||
var ballSpawnerPosition = Entities.getEntityProperties(data.tiltMaze.ballSpawner, 'position').position;
|
var ballSpawnerPosition = Entities.getEntityProperties(data.tiltMaze.ballSpawner, 'position').position;
|
||||||
|
|
||||||
var separation = Vec3.distance(ballPosition, ballSpawnerPosition);
|
var separation = Vec3.distance(ballPosition, ballSpawnerPosition);
|
||||||
|
print('ball separation: ' + separation)
|
||||||
if (separation > BALL_DISTANCE_THRESHOLD) {
|
if (separation > BALL_DISTANCE_THRESHOLD) {
|
||||||
this.destroyBall();
|
this.destroyBall();
|
||||||
this.createBall();
|
this.createBall();
|
||||||
|
@ -227,8 +229,12 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
print('in update loop for maze, look for balls to clear')
|
||||||
|
|
||||||
this.testBallDistance()
|
_this.testBallDistance()
|
||||||
|
},
|
||||||
|
unload:function(){
|
||||||
|
Script.update.disconnect(this.update);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue