Spaces:
Running
Running
File size: 680 Bytes
4ee4376 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import traffic from '../simulation/micro/traffic';
import highwayTraffic from '../simulation/micro/highwayTraffic';
export default class simulation {
constructor (options) {
this.cell = options.cell;
this.simulations = {};
}
create () {
if (this.cell.road)
this.simulators.traffic = new traffic({ cell: this.cell });
if (this.cell.highway)
this.simulators.highwayTraffic = new highwayTraffic({ cell: this.cell });
Object.keys(this.simulators).forEach((sim) => {
this.simulations[sim].create();
});
}
update () {
Object.keys(this.simulations).forEach((sim) => {
this.simulations[sim].update();
});
}
} |