This commit is contained in:
dgflash
2024-08-28 12:28:31 +08:00
2 changed files with 5 additions and 3 deletions

View File

@@ -96,13 +96,15 @@ export class ECSEntity {
/**
* 移除子实体
* @param entity 被移除的实体对象
* @param entity 被移除的实体对象
* @param isDestroy 被移除的实体是否释放,默认为释放
* @returns
*/
removeChild(entity: ECSEntity) {
removeChild(entity: ECSEntity, isDestroy = true) {
if (this.children == null) return;
this.children.delete(entity.eid);
if (isDestroy) entity.destroy();
if (this.children.size == 0) {
this._children = null;

View File

@@ -370,7 +370,7 @@ export class GameComponent extends Component {
for (const name of args) {
var func = self[name];
if (func)
this.on(name, self[name], this);
this.on(name, func, this);
else
console.error(`名为【${name}】的全局事方法不存在`);
}