新增getComponentInScene
This commit is contained in:
@@ -409,6 +409,15 @@ module es {
|
||||
return this.components.getComponent(type, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类型T的第一个并已加入场景的组件并返回它。如果没有找到组件,则返回null。
|
||||
* @param type
|
||||
* @returns
|
||||
*/
|
||||
public getComponentInScene<T extends Component>(type: new (...args) => T): T {
|
||||
return this.components.getComponent(type, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 尝试获取T类型的组件。如果未找到任何组件,则返回false
|
||||
* @param type
|
||||
|
||||
Reference in New Issue
Block a user