sim-1 / OpenSC2K-master /src /cell /simulation.js
Omnibus's picture
Upload 131 files
4ee4376
raw
history blame contribute delete
680 Bytes
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();
});
}
}