Last active
          August 29, 2015 14:25 
        
      - 
      
- 
        Save williamn/23c1b6aefb1de107ef54 to your computer and use it in GitHub Desktop. 
    Elevator Saga
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| init: function(elevators, floors) { | |
| var elevator = elevators[0]; // Let's use the first elevator | |
| _.each(floors, function(floor) { | |
| floor.on("up_button_pressed down_button_pressed", function() { | |
| elevator.goToFloor(floor.floorNum()); | |
| }); | |
| }); | |
| 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