优化entitylist

This commit is contained in:
yhh
2020-11-26 20:02:53 +08:00
parent ae2cfdafdd
commit 6113fd9986
5 changed files with 125 additions and 156 deletions

View File

@@ -1,7 +1,16 @@
module es {
export class EntityComparer implements IComparer<Entity> {
public compare(self: Entity, other: Entity): number {
let compare = self.updateOrder - other.updateOrder;
if (compare == 0)
compare = self.id - other.id;
return compare;
}
}
export class Entity {
public static _idGenerator: number = 0;
public static entityComparer: IComparer<Entity> = new EntityComparer();
/**
* 当前实体所属的场景
*/