You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
539 B
Markdown
18 lines
539 B
Markdown
5 years ago
|
```js
|
||
|
{
|
||
|
init: function(elevators, floors) {
|
||
|
var elevator = elevators[0]; // Let's use the first elevator
|
||
|
|
||
|
// Whenever the elevator is idle (has no more queued destinations) ...
|
||
|
elevator.on("idle", function() {
|
||
|
// let's go to all the floors (or did we forget one?)
|
||
|
elevator.goToFloor(0);
|
||
|
elevator.goToFloor(1);
|
||
|
elevator.goToFloor(2);
|
||
|
});
|
||
|
},
|
||
|
update: function(dt, elevators, floors) {
|
||
|
// We normally don't need to do anything here
|
||
|
}
|
||
|
}
|
||
|
```
|