Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- init: function(elevators, floors) {
- var elevator = elevators[0]; // Let's use the first elevator
- var floor = floors;
- elevator.on("idle", function() {
- elevator.goToFloor(0);
- elevator.checkDestinationQueue();
- elevator.goToFloor(elevator.destinationQueue[0]);
- });
- elevator.on("floor_button_pressed", function(floorNum){
- elevator.destinationQueue.push(floorNum);
- elevator.destinationQueue.sort();
- elevator.goToFloor(elevator.destinationQueue[0]);
- })
- },
- update: function(dt, elevators, floors) {
- // We normally don't need to do anything here
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement