content/hifi-content/rebecca/LedWorld/BallPit/dropTower.js
2022-02-14 02:04:11 +01:00

59 lines
1.9 KiB
JavaScript

//
// dropTower.js
//
// Created by Rebecca Stankus on 12/11/17.
// Copyright 2017 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
// This script acts on the platform for the drop tower to make it move up and down.
//
(function () {
var DROP_INTERVAL_MS=15000;
var START_POSITION = {x: -17.8275, y: -9.9549, z: 3.7508};
var interval;
var newPosition;
var DropTower = function() {
};
DropTower.prototype = {
preload:function() {
print("hi...you've reached the preload function of dropTower");
this.move();
},
move:function(){
print("hi...you've reached the move function of dropTower");
newPosition = START_POSITION;
interval = Script.setInterval(function() {
var i;
for (i = 0;i<45000;i++){
newPosition.y += 0.001;
Entities.editEntity("{1cb0a40a-7215-41df-8adf-87aab9abed1c}",{
position:newPosition,
visible:false
});
}
print("hi...you've reached the the top of the dropTower");
for (i = 0;i<45000;i++){
newPosition.y -= 0.001;
Entities.editEntity("{1cb0a40a-7215-41df-8adf-87aab9abed1c}",{
position:newPosition,
visible:true
});
}
}, DROP_INTERVAL_MS);
},
unload:function() {
if (interval){
Script.clearInterval(interval);
}
}
};
var dropItLikeItsHot = new DropTower();
return dropItLikeItsHot;
});