perf: tickSynchronized to skip most trait tickers

This commit is contained in:
cha0s 2019-05-08 21:28:47 -05:00
parent 14a252db3a
commit c937aae5ef
4 changed files with 10 additions and 2 deletions

View File

@ -83,7 +83,7 @@ export function Synchronized(Superclass) {
return [];
}
tick(elapsed) {
tickSynchronized(elapsed) {
for (let i = 0; i < this._childrenTickers.length; ++i) {
this._childrenTickers[i](elapsed);
}

View File

@ -177,6 +177,10 @@ export class Layer extends decorate(class {}) {
];
}
tick(elapsed) {
this.tickSynchronized(elapsed);
}
visibleEntities(query) {
return this.entityList.visibleEntities(query);
}

View File

@ -153,7 +153,7 @@ export class Room extends decorate(class {}) {
}
tick(elapsed) {
super.tick(elapsed);
this.tickSynchronized(elapsed);
if (this.world) {
this.world.tick(elapsed);
}

View File

@ -113,6 +113,10 @@ export class Tiles extends decorate(class {}) {
];
}
tick(elapsed) {
this.tickSynchronized(elapsed);
}
tileAt(x, y) {
return this.data.get(y * this.width + x);
}