@antv/g-ecs
Advanced tools
Comparing version 1.0.0-alpha.12 to 1.0.0-alpha.13
@@ -20,2 +20,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "Entity", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Entity.Entity; | ||
} | ||
}); | ||
Object.defineProperty(exports, "EntityManager", { | ||
@@ -27,6 +33,6 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "Entity", { | ||
Object.defineProperty(exports, "Matcher", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Entity.Entity; | ||
return _Matcher.Matcher; | ||
} | ||
@@ -40,8 +46,2 @@ }); | ||
}); | ||
Object.defineProperty(exports, "Matcher", { | ||
enumerable: true, | ||
get: function get() { | ||
return _Matcher.Matcher; | ||
} | ||
}); | ||
exports.containerModule = void 0; | ||
@@ -48,0 +48,0 @@ |
{ | ||
"name": "@antv/g-ecs", | ||
"version": "1.0.0-alpha.12", | ||
"version": "1.0.0-alpha.13", | ||
"description": "A simple ECS implement", | ||
@@ -8,5 +8,8 @@ "main": "lib/index.js", | ||
"types": "es/index.d.ts", | ||
"unpkg": "dist/index.umd.js", | ||
"files": [ | ||
"package.json", | ||
"dist", | ||
"es", | ||
"lib", | ||
"LICENSE", | ||
@@ -44,3 +47,3 @@ "README.md" | ||
}, | ||
"gitHead": "b8af919853fa578b4aa6c5e84715948085ac0170" | ||
"gitHead": "97b0cd921c395a28d0432b33db157723b7967db1" | ||
} |
@@ -5,7 +5,5 @@ English | [简体中文](./README-zh_CN.md) | ||
[![](https://img.shields.io/travis/antvis/g-ecs.svg)](https://travis-ci.org/antvis/g-ecs) | ||
![](https://img.shields.io/badge/language-javascript-red.svg) | ||
![](https://img.shields.io/badge/license-MIT-000000.svg) | ||
[![](https://img.shields.io/travis/antvis/g-ecs.svg)](https://travis-ci.org/antvis/g-ecs) ![](https://img.shields.io/badge/language-javascript-red.svg) ![](https://img.shields.io/badge/license-MIT-000000.svg) | ||
- a simple ECS implement for G | ||
- a simple ECS implement for G | ||
@@ -27,3 +25,3 @@ ## Architecture | ||
// load ECS module | ||
container.load(containerModule); | ||
container.load(containerModule, true); | ||
@@ -35,10 +33,10 @@ // create a world | ||
class C1 extends Component { | ||
static tag = 'c1'; | ||
p1: number; | ||
static tag = 'c1'; | ||
p1: number; | ||
} | ||
class C2 extends Component { | ||
static tag = 'c2'; | ||
static tag = 'c2'; | ||
} | ||
class C3 extends Component { | ||
static tag = 'c3'; | ||
static tag = 'c3'; | ||
} | ||
@@ -49,14 +47,14 @@ world.registerComponent(C1).registerComponent(C2).registerComponent(C3); | ||
class S1 extends System { | ||
static tag = 's1'; | ||
static tag = 's1'; | ||
trigger() { | ||
return new Matcher().allOf(C1); | ||
} | ||
trigger() { | ||
return new Matcher().allOf(C1); | ||
} | ||
execute(entities: Entity[]) { | ||
entities.forEach((entity) => { | ||
const c1 = entity.getComponent(C1); | ||
c1.p1++; | ||
}); | ||
} | ||
execute(entities: Entity[]) { | ||
entities.forEach((entity) => { | ||
const c1 = entity.getComponent(C1); | ||
c1.p1++; | ||
}); | ||
} | ||
} | ||
@@ -72,9 +70,9 @@ world.registerSystem(S1); | ||
const run = () => { | ||
const time = performance.now(); | ||
const delta = time - lastTime; | ||
// run all the systems | ||
world.execute(delta, time); | ||
const time = performance.now(); | ||
const delta = time - lastTime; | ||
// run all the systems | ||
world.execute(delta, time); | ||
lastTime = time; | ||
requestAnimationFrame(run); | ||
lastTime = time; | ||
requestAnimationFrame(run); | ||
}; | ||
@@ -95,3 +93,3 @@ run(); | ||
// load ECS module | ||
container.load(containerModule); | ||
container.load(containerModule, true); | ||
@@ -114,10 +112,10 @@ // create a world | ||
class C1 extends Component { | ||
static tag = 'c1'; | ||
p1: number; | ||
static tag = 'c1'; | ||
p1: number; | ||
} | ||
class C2 extends Component { | ||
static tag = 'c2'; | ||
static tag = 'c2'; | ||
} | ||
class C3 extends Component { | ||
static tag = 'c3'; | ||
static tag = 'c3'; | ||
} | ||
@@ -131,14 +129,14 @@ world.registerComponent(C1).registerComponent(C2).registerComponent(C3); | ||
class S1 extends System { | ||
static tag = 's1'; | ||
static tag = 's1'; | ||
trigger() { | ||
return new Matcher().allOf(C1); | ||
} | ||
trigger() { | ||
return new Matcher().allOf(C1); | ||
} | ||
execute(entities: Entity[]) { | ||
entities.forEach((entity) => { | ||
const c1 = entity.getComponent(C1); | ||
c1.p1++; | ||
}); | ||
} | ||
execute(entities: Entity[]) { | ||
entities.forEach((entity) => { | ||
const c1 = entity.getComponent(C1); | ||
c1.p1++; | ||
}); | ||
} | ||
} | ||
@@ -172,4 +170,4 @@ world.registerSystem(S1); | ||
- [ecsy](https://blog.mozvr.com/introducing-ecsy/) | ||
- [Entitas](https://github.com/sschmid/Entitas-CSharp) | ||
- [EntitasCookBook](https://github.com/mzaks/EntitasCookBook) | ||
- [ecsy](https://blog.mozvr.com/introducing-ecsy/) | ||
- [Entitas](https://github.com/sschmid/Entitas-CSharp) | ||
- [EntitasCookBook](https://github.com/mzaks/EntitasCookBook) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
64665
46
1726
165