优化component add/remove效率
This commit is contained in:
@@ -8,11 +8,20 @@ module es {
|
||||
* - onRemovedFromEntity
|
||||
*/
|
||||
export abstract class Component {
|
||||
public static _idGenerator: number = 0;
|
||||
/**
|
||||
* 此组件的唯一标识
|
||||
*/
|
||||
public readonly id: number;
|
||||
/**
|
||||
* 此组件附加的实体
|
||||
*/
|
||||
public entity: Entity;
|
||||
|
||||
constructor() {
|
||||
this.id = Component._idGenerator++;
|
||||
}
|
||||
|
||||
/**
|
||||
* 快速访问 this.entity.transform
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user