This commit is contained in:
dgflash
2022-05-09 11:51:03 +08:00
parent 606de37c01
commit 51ece8d7c5
2 changed files with 5 additions and 2 deletions

View File

@@ -7,11 +7,14 @@ import { createGroup, ECSComblockSystem, ECSRootSystem, ECSSystem } from "./ECSS
export module ecs {
export type Entity = ECSEntity;
export type Comp = ECSComp;
export type System = ECSSystem;
export type RootSystem = ECSRootSystem;
export type ComblockSystem = ECSComblockSystem;
export const Entity = ECSEntity;
export const Comp = ECSComp;
export const RootSystem = ECSRootSystem;
export const System = ECSSystem;
export const RootSystem = ECSRootSystem;
export const ComblockSystem = ECSComblockSystem;
/** 注:不要尝试修改此对象数据,非对外使用 */

View File

@@ -87,7 +87,6 @@ export class ECSEntity {
add<T extends ecs.IComp>(ctor: ecs.CompCtor<T>, isReAdd?: boolean): T;
add<T extends ecs.IComp>(ctor: ecs.CompType<T>, isReAdd?: boolean): T;
add<T extends ecs.IComp>(ctor: ecs.CompType<T> | T, isReAdd: boolean = false): T | ECSEntity {
// console.log('typeof: ', typeof ctor);
if (typeof ctor === 'function') {
let compTid = ctor.tid;
if (ctor.tid === -1) {
@@ -146,6 +145,7 @@ export class ECSEntity {
//@ts-ignore
ctor.canRecycle = false;
broadcastCompAddOrRemove(this, compTid);
return this;
}
}