Skip to content

Instantly share code, notes, and snippets.

@michitomo
Last active May 17, 2016 11:33
Show Gist options
  • Save michitomo/90b714b8cb2ef7bd055e0339ed92eb8b to your computer and use it in GitHub Desktop.
Save michitomo/90b714b8cb2ef7bd055e0339ed92eb8b to your computer and use it in GitHub Desktop.
{
init: function(elevators, floors) {
_.each(elevators, function(elevator) {
elevator.on("idle", function() {
_.each(floors, function(floor) {
floor.on("up_button_pressed", function() {
elevator.goToFloor(floor.level);
});
floor.on("down_button_pressed", function() {
elevator.goToFloor(floor.level);
});
elevator.on("floor_button_pressed", function(floorNum) {
elevator.goToFloor(floorNum);
});
});
});
});
},
update: function(dt, elevators, floors) {
// We normally don't need to do anything here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment