react-simple-game-engine 0.0.27 → 0.0.30
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/logic-component.d.ts +2 -3
- package/lib/classes/logic-component.d.ts.map +1 -1
- package/lib/classes/logic-component.js +4 -1
- package/lib/classes/particle-system.d.ts +1 -3
- package/lib/classes/particle-system.d.ts.map +1 -1
- package/lib/classes/particle-system.js +1 -2
- package/lib/classes/scene.d.ts +3 -1
- package/lib/classes/scene.d.ts.map +1 -1
- package/lib/classes/scene.js +2 -3
- package/package.json +1 -1
@@ -1,10 +1,9 @@
|
|
1
1
|
import { Configable } from "../export-types";
|
2
|
-
import { Entity } from "./entities/entity";
|
3
2
|
export declare class LogicComponent<C extends {
|
4
3
|
initial: any;
|
5
|
-
}
|
4
|
+
}> {
|
6
5
|
private instance;
|
7
6
|
constructor(configale: Configable<C>);
|
8
|
-
output(): C;
|
7
|
+
output(extraParams?: Record<string, any>): C;
|
9
8
|
}
|
10
9
|
//# 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,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"logic-component.d.ts","sourceRoot":"","sources":["../../src/classes/logic-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,qBAAa,cAAc,CAAC,CAAC,SAAS;IAAE,OAAO,EAAE,GAAG,CAAA;CAAE;IACpD,OAAO,CAAC,QAAQ,CAAI;gBACR,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IAOpC,MAAM,CAAC,WAAW,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;CAI7C"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { copyProperties } from "../utils";
|
1
2
|
var LogicComponent = /** @class */ (function () {
|
2
3
|
function LogicComponent(configale) {
|
3
4
|
var _a = Array.isArray(configale) ? configale : [configale], Class = _a[0], params = _a[1];
|
@@ -5,7 +6,9 @@ var LogicComponent = /** @class */ (function () {
|
|
5
6
|
c.initial(params);
|
6
7
|
this.instance = c;
|
7
8
|
}
|
8
|
-
LogicComponent.prototype.output = function () {
|
9
|
+
LogicComponent.prototype.output = function (extraParams) {
|
10
|
+
if (extraParams === void 0) { extraParams = {}; }
|
11
|
+
copyProperties(this.instance, extraParams);
|
9
12
|
return this.instance;
|
10
13
|
};
|
11
14
|
return LogicComponent;
|
@@ -1,13 +1,11 @@
|
|
1
1
|
import p5 from "p5";
|
2
2
|
import { Particle } from "./particle";
|
3
|
-
import { WorldManagement } from "./world-management";
|
4
3
|
export declare class ParticleSystem {
|
5
|
-
private worldManagement;
|
6
4
|
private particles;
|
7
5
|
private forces;
|
8
6
|
x: number;
|
9
7
|
y: number;
|
10
|
-
active(
|
8
|
+
active(): void;
|
11
9
|
initial({ x, y, length, quantity, forces, ...params }: Omit<Parameters<Particle["initial"]>[0], "vec" | "angle"> & {
|
12
10
|
quantity?: number;
|
13
11
|
length?: number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"particle-system.d.ts","sourceRoot":"","sources":["../../src/classes/particle-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"particle-system.d.ts","sourceRoot":"","sources":["../../src/classes/particle-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,qBAAa,cAAc;IACzB,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,MAAM,CAAmB;IAC1B,CAAC,EAAG,MAAM,CAAC;IACX,CAAC,EAAG,MAAM,CAAC;IAElB,MAAM;IAIN,OAAO,CAAC,EACN,CAAC,EACD,CAAC,EACD,MAAW,EACX,QAAc,EACd,MAAM,EACN,GAAG,MAAM,EACV,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,GAAG;QAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC;QACrB,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX;IAmBD,MAAM;IAaN,IAAI;CAKL"}
|
@@ -26,9 +26,8 @@ var ParticleSystem = /** @class */ (function () {
|
|
26
26
|
function ParticleSystem() {
|
27
27
|
this.forces = [];
|
28
28
|
}
|
29
|
-
ParticleSystem.prototype.active = function (
|
29
|
+
ParticleSystem.prototype.active = function () {
|
30
30
|
console.log("Initted particle system");
|
31
|
-
this.worldManagement = worldManagement;
|
32
31
|
};
|
33
32
|
ParticleSystem.prototype.initial = function (_a) {
|
34
33
|
var _b;
|
package/lib/classes/scene.d.ts
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
import { ComponentType } from "react";
|
2
|
+
import { Entity } from "./entities/entity";
|
2
3
|
import { Camera } from "./camera";
|
3
4
|
import { LogicComponent } from "./logic-component";
|
4
5
|
import { SceneManagement } from "./scene-management";
|
6
|
+
import { ParticleSystem } from "./particle-system";
|
5
7
|
declare type LoadAssetsListener = (loadedAssets: boolean) => void;
|
6
8
|
export declare abstract class Scene<UIP = any> {
|
7
9
|
private ui;
|
@@ -12,7 +14,7 @@ export declare abstract class Scene<UIP = any> {
|
|
12
14
|
tag: string;
|
13
15
|
manager: SceneManagement;
|
14
16
|
readonly sessionId: string;
|
15
|
-
abstract getComponents(): LogicComponent[];
|
17
|
+
abstract getComponents(camera: Camera): LogicComponent<Entity | ParticleSystem>[];
|
16
18
|
constructor();
|
17
19
|
get UI(): ComponentType<UIP>;
|
18
20
|
get UIProps(): UIP;
|
@@ -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;
|
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,mBAAmB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,aAAK,kBAAkB,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,CAC3B,MAAM,EAAE,MAAM,GACb,cAAc,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE;;IAS5C,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;IAaxB,SAAS,CAAC,MAAM;IAChB,SAAS,CAAC,QAAQ;IAElB,MAAM;CAQP"}
|
package/lib/classes/scene.js
CHANGED
@@ -118,12 +118,11 @@ var Scene = /** @class */ (function () {
|
|
118
118
|
};
|
119
119
|
Scene.prototype.bootstrap = function (camera) {
|
120
120
|
this.worldManagement = new WorldManagement();
|
121
|
-
var components = this.getComponents();
|
121
|
+
var components = this.getComponents(camera);
|
122
122
|
for (var _i = 0, components_1 = components; _i < components_1.length; _i++) {
|
123
123
|
var component = components_1[_i];
|
124
|
-
var entity = component.output();
|
124
|
+
var entity = component.output({ camera: camera });
|
125
125
|
if (entity instanceof Entity) {
|
126
|
-
entity.camera = camera;
|
127
126
|
this.worldManagement.addEntity(entity);
|
128
127
|
}
|
129
128
|
else {
|