react-simple-game-engine 0.0.47 → 0.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/classes/entities/entity-sult.d.ts +2 -1
- package/lib/classes/entities/entity-sult.d.ts.map +1 -1
- package/lib/classes/entities/entity-sult.js +4 -2
- package/lib/classes/logic-component.d.ts +4 -1
- package/lib/classes/logic-component.d.ts.map +1 -1
- package/lib/classes/logic-component.js +23 -6
- package/lib/classes/scene.d.ts.map +1 -1
- package/lib/classes/scene.js +1 -0
- package/lib/classes/world-management.js +1 -1
- package/package.json +1 -1
@@ -14,7 +14,8 @@ export declare abstract class EntitySult<P = any> implements Initialler<P> {
|
|
14
14
|
get scene(): Scene<any>;
|
15
15
|
get worldManagement(): WorldManagement;
|
16
16
|
getProperty<T>(name: string): T;
|
17
|
-
|
17
|
+
preInitial(worldManagement: WorldManagement): void;
|
18
|
+
active(): void;
|
18
19
|
onActive(): void;
|
19
20
|
initial(params: P): void;
|
20
21
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"entity-sult.d.ts","sourceRoot":"","sources":["../../../src/classes/entities/entity-sult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,8BAAsB,UAAU,CAAC,CAAC,GAAG,GAAG,CAAE,YAAW,UAAU,CAAC,CAAC,CAAC;IACzD,MAAM,EAAG,MAAM,CAAC;IACvB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAsD;IACzE,SAAgB,GAAG,EAAG,MAAM,CAAC;IAE7B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,gBAAgB,CAAmB;;IAM3C,QAAQ,CAAC,MAAM,IAAI,IAAI;IACvB,QAAQ,CAAC,IAAI,IAAI,IAAI;IAErB,IAAI,KAAK,eAER;IAED,IAAI,eAAe,oBAElB;IAED,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;IAI/B,
|
1
|
+
{"version":3,"file":"entity-sult.d.ts","sourceRoot":"","sources":["../../../src/classes/entities/entity-sult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,8BAAsB,UAAU,CAAC,CAAC,GAAG,GAAG,CAAE,YAAW,UAAU,CAAC,CAAC,CAAC;IACzD,MAAM,EAAG,MAAM,CAAC;IACvB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAsD;IACzE,SAAgB,GAAG,EAAG,MAAM,CAAC;IAE7B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,gBAAgB,CAAmB;;IAM3C,QAAQ,CAAC,MAAM,IAAI,IAAI;IACvB,QAAQ,CAAC,IAAI,IAAI,IAAI;IAErB,IAAI,KAAK,eAER;IAED,IAAI,eAAe,oBAElB;IAED,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;IAI/B,UAAU,CAAC,eAAe,EAAE,eAAe;IAM3C,MAAM;IAKN,QAAQ;IACR,OAAO,CAAC,MAAM,EAAE,CAAC;CAClB"}
|
@@ -20,11 +20,13 @@ var EntitySult = /** @class */ (function () {
|
|
20
20
|
EntitySult.prototype.getProperty = function (name) {
|
21
21
|
return this[name];
|
22
22
|
};
|
23
|
-
EntitySult.prototype.
|
24
|
-
console.log("Initted ".concat(this.tag, " entity (id : ").concat(this.id, ")"));
|
23
|
+
EntitySult.prototype.preInitial = function (worldManagement) {
|
25
24
|
this._worldManagement = worldManagement;
|
26
25
|
this._scene = this.scene;
|
27
26
|
this.camera = worldManagement.camera;
|
27
|
+
};
|
28
|
+
EntitySult.prototype.active = function () {
|
29
|
+
console.log("Initted ".concat(this.tag, " entity (id : ").concat(this.id, ")"));
|
28
30
|
this.onActive();
|
29
31
|
};
|
30
32
|
EntitySult.prototype.onActive = function () { };
|
@@ -1,8 +1,11 @@
|
|
1
1
|
import { Initialler } from "../export-interfaces";
|
2
2
|
import { Configable } from "../export-types";
|
3
|
+
import { WorldManagement } from "./world-management";
|
3
4
|
export declare class LogicComponent<C extends Initialler = Initialler> {
|
4
|
-
private
|
5
|
+
private configale;
|
6
|
+
private _worldManagement?;
|
5
7
|
constructor(configale: Configable<C>);
|
8
|
+
set worldManagement(worldManagement: WorldManagement);
|
6
9
|
output(extraParams?: Record<string, any>): C;
|
7
10
|
}
|
8
11
|
//# sourceMappingURL=logic-component.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"logic-component.d.ts","sourceRoot":"","sources":["../../src/classes/logic-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,qBAAa,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;
|
1
|
+
{"version":3,"file":"logic-component.d.ts","sourceRoot":"","sources":["../../src/classes/logic-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAAa,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAG/C,OAAO,CAAC,SAAS;IAF7B,OAAO,CAAC,gBAAgB,CAAC,CAAkB;gBAEvB,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IAE5C,IAAI,eAAe,CAAC,eAAe,EAAE,eAAe,EAMnD;IAED,MAAM,CAAC,WAAW,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;CAW7C"}
|
@@ -1,15 +1,32 @@
|
|
1
1
|
import { copyProperties } from "../utils";
|
2
|
+
import { EntitySult } from "./entities/entity-sult";
|
2
3
|
var LogicComponent = /** @class */ (function () {
|
3
4
|
function LogicComponent(configale) {
|
4
|
-
|
5
|
-
var c = new Class();
|
6
|
-
c.initial(params);
|
7
|
-
this.instance = c;
|
5
|
+
this.configale = configale;
|
8
6
|
}
|
7
|
+
Object.defineProperty(LogicComponent.prototype, "worldManagement", {
|
8
|
+
set: function (worldManagement) {
|
9
|
+
if (this._worldManagement) {
|
10
|
+
this._worldManagement = worldManagement;
|
11
|
+
}
|
12
|
+
else {
|
13
|
+
console.warn("Can not change world");
|
14
|
+
}
|
15
|
+
},
|
16
|
+
enumerable: false,
|
17
|
+
configurable: true
|
18
|
+
});
|
9
19
|
LogicComponent.prototype.output = function (extraParams) {
|
10
20
|
if (extraParams === void 0) { extraParams = {}; }
|
11
|
-
|
12
|
-
|
21
|
+
var configale = this.configale;
|
22
|
+
var _a = Array.isArray(configale) ? configale : [configale], Class = _a[0], params = _a[1];
|
23
|
+
var c = new Class();
|
24
|
+
if (c instanceof EntitySult && this._worldManagement) {
|
25
|
+
c.preInitial(this._worldManagement);
|
26
|
+
}
|
27
|
+
c.initial(params);
|
28
|
+
copyProperties(c, extraParams);
|
29
|
+
return c;
|
13
30
|
};
|
14
31
|
return LogicComponent;
|
15
32
|
}());
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../src/classes/scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;A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BAAkB,GAAG,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;AAE1D,8BAAsB,KAAK,CAAC,GAAG,GAAG,GAAG;IACnC,OAAO,CAAC,EAAE,CAAqB;IAC/B,OAAO,CAAC,eAAe,CAAmB;IAC1C,OAAO,CAAC,aAAa,CAAW;IAChC,OAAO,CAAC,kBAAkB,CAAsB;IAEzC,WAAW,EAAE,MAAM,CAAK;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAG,eAAe,CAAC;IACjC,SAAgB,SAAS,EAAE,MAAM,CAA8C;aAC/D,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,EAAE;;IAS3E,IAAI,EAAE,uBAGL;IAED,IAAI,OAAO,QAEV;IAED,SAAS,CAAC,MAAM;IAEhB,SAAS,CAAC,UAAU;IAIpB,IAAI,YAAY,YAEf;IAED,iBAAiB,CAAC,IAAI,EAAE,kBAAkB;IAI1C,UAAU;IAIV,kBAAkB,CAAC,YAAY,EAAE,OAAO;IAKxC,aAAa,CAAC,GAAG,EAAE,MAAM;IAInB,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM;IAczB,YAAY;IAElB,SAAS,CAAC,MAAM,EAAE,MAAM;IAUxB,SAAS,CAAC,MAAM;IAChB,SAAS,CAAC,QAAQ;IAElB,MAAM;CAQP"}
|
package/lib/classes/scene.js
CHANGED
@@ -120,6 +120,7 @@ var Scene = /** @class */ (function () {
|
|
120
120
|
var components = this.getComponents(camera);
|
121
121
|
for (var _i = 0, components_1 = components; _i < components_1.length; _i++) {
|
122
122
|
var component = components_1[_i];
|
123
|
+
component.worldManagement = this.worldManagement;
|
123
124
|
var entity = component.output();
|
124
125
|
this.worldManagement.addEntity(entity);
|
125
126
|
}
|
@@ -58,7 +58,7 @@ var WorldManagement = /** @class */ (function () {
|
|
58
58
|
if (entity instanceof Entity) {
|
59
59
|
World.add(this.engine.world, entity.body);
|
60
60
|
}
|
61
|
-
entity.active(
|
61
|
+
entity.active();
|
62
62
|
};
|
63
63
|
WorldManagement.prototype.removeEntity = function (entity) {
|
64
64
|
var delIndex = this.entities.indexOf(entity);
|