修复transform.setparent报错
This commit is contained in:
@@ -200,6 +200,15 @@ module es {
|
||||
return this.entities.entitiesWithTag(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回提一个具有该标记的实体
|
||||
* @param tag
|
||||
* @returns
|
||||
*/
|
||||
public findEntityWithTag(tag: number): Entity {
|
||||
return this.entities.entityWithTag(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回类型为T的所有实体
|
||||
* @param type
|
||||
|
||||
@@ -266,9 +266,13 @@ module es {
|
||||
if (this._parent == parent)
|
||||
return this;
|
||||
|
||||
if (!this._parent) {
|
||||
if (this._parent != null) {
|
||||
let children = new es.List(this._parent._children);
|
||||
children.remove(this);
|
||||
}
|
||||
|
||||
if (parent != null) {
|
||||
let children = new es.List(parent._children);
|
||||
children.add(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,6 @@ module es {
|
||||
let list = this.getTagList(tag);
|
||||
|
||||
let returnList = ListPool.obtain<Entity>();
|
||||
returnList.length = this._entities.length;
|
||||
for (let entity of list) {
|
||||
returnList.push(entity);
|
||||
}
|
||||
@@ -202,6 +201,21 @@ module es {
|
||||
return returnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回第一个找到该tag的实体
|
||||
* @param tag
|
||||
* @returns
|
||||
*/
|
||||
public entityWithTag(tag: number) {
|
||||
let list = this.getTagList(tag);
|
||||
|
||||
for (let entity of list) {
|
||||
return entity;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回一个T类型的所有实体的列表。
|
||||
* 返回的List可以通过ListPool.free放回池中。
|
||||
|
||||
Reference in New Issue
Block a user