ECSEntity.removeChild添加isDestroy是否释放实体参数

This commit is contained in:
dgflash
2024-08-26 16:41:02 +08:00
parent 13e1075f54
commit 947b44b93b

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;