mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-25 06:05:52 +02:00
Archive commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { Controller, ServerEntity, ServerMap } from '../serverInterfaces';
|
||||
import { timingStart, timingEnd } from '../timing';
|
||||
|
||||
export class UpdateController implements Controller {
|
||||
private updatables: ServerEntity[] = [];
|
||||
constructor(private map: ServerMap) {
|
||||
}
|
||||
initialize() {
|
||||
this.updatables = [];
|
||||
|
||||
for (const region of this.map.regions) {
|
||||
for (const entity of region.entities) {
|
||||
if (entity.serverUpdate) {
|
||||
this.updatables.push(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
update(delta: number, now: number) {
|
||||
timingStart('TorchController.update()');
|
||||
|
||||
for (const entity of this.updatables) {
|
||||
entity.serverUpdate!(delta, now);
|
||||
}
|
||||
|
||||
timingEnd();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user