mirror of
https://gitee.com/dgflash/oops-framework.git
synced 2026-05-14 05:45:54 +08:00
.
This commit is contained in:
@@ -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;
|
||||
|
||||
/** 注:不要尝试修改此对象数据,非对外使用 */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user