react-simple-game-engine 0.2.131 → 0.2.132
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.d.ts +12 -0
- package/lib/classes/entities/entity.d.ts.map +1 -1
- package/lib/classes/entities/entity.js +15 -3
- package/lib/classes/sensor.d.ts +3 -2
- package/lib/classes/sensor.d.ts.map +1 -1
- package/lib/classes/sensor.js +2 -1
- package/lib/classes/world-management.d.ts.map +1 -1
- package/lib/classes/world-management.js +20 -14
- package/package.json +1 -1
@@ -36,6 +36,7 @@ export declare abstract class Entity<P extends Record<string, any> = Record<stri
|
|
36
36
|
private _props;
|
37
37
|
private timerJobListeners;
|
38
38
|
private isTerminate;
|
39
|
+
debugSensor: boolean;
|
39
40
|
readonly sensors: Sensor[];
|
40
41
|
enabledGravity: boolean;
|
41
42
|
sound?: Sound;
|
@@ -67,6 +68,17 @@ export declare abstract class Entity<P extends Record<string, any> = Record<stri
|
|
67
68
|
*/
|
68
69
|
onTimer(interval: number, job: TimerJobListener, { defaultRun, once, startFrom, onRegisterDone, }?: TimerOptions): () => void;
|
69
70
|
removeSensor(sensor: Sensor): void;
|
71
|
+
/**
|
72
|
+
* @param {Point} position delta position of sensor base on entity position
|
73
|
+
* @param {string} name name of sensor
|
74
|
+
* @param {"rect"|"circle"} shape type of shape of physical body, ex: "rect"|"circle"
|
75
|
+
* @param {number} width width of sensor, apply when in "rect" shape
|
76
|
+
* @param {number} height height of sensor, apply when in "rect" shape
|
77
|
+
* @param {number} radius radius of sensor, apply when in "circle" shape
|
78
|
+
* @param {boolean} debug allow to show sensor for debug purpose
|
79
|
+
* @param {boolean} debugColor allow to change sensor color
|
80
|
+
* @void
|
81
|
+
*/
|
70
82
|
addSensor({ position, name, shape, width, height, radius }: AddSensorParams, debug?: boolean, debugColor?: Color): void;
|
71
83
|
createBody(enabledPhysicBody: boolean, transform: CreateBodyDefine["transform"], options?: CreateBodyDefine["bodyOptions"]): MasterBody | {
|
72
84
|
position: Point;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/classes/entities/entity.ts"],"names":[],"mappings":"AAAA,OAAO,MAAwB,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,UAAU,EACV,KAAK,EAEN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,aAAK,gBAAgB,GAAG,MAAM,IAAI,CAAC;AAEnC,aAAK,gBAAgB,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;CACjD,CAAC;AAEF,aAAK,YAAY,GAAG;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,aAAK,eAAe,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB,GAAG,CACA;IACE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,GACD;IACE,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,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AQ;IAER,IAAI;IAOJ;;;OAGG;IACH,MAAM;IAEN,QAAQ,CAAC,oBAAoB,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAElE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IACnC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IACtC,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAEzC,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IACzD,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAC5D,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAChE"}
|
@@ -47,6 +47,7 @@ var Entity = /** @class */ (function (_super) {
|
|
47
47
|
_this._props = {};
|
48
48
|
_this.timerJobListeners = [];
|
49
49
|
_this.isTerminate = false;
|
50
|
+
_this.debugSensor = false;
|
50
51
|
_this.sensors = [];
|
51
52
|
_this.enabledGravity = true;
|
52
53
|
return _this;
|
@@ -161,19 +162,30 @@ var Entity = /** @class */ (function (_super) {
|
|
161
162
|
this.worldManagement.removeBody(sensor.body);
|
162
163
|
}
|
163
164
|
};
|
165
|
+
/**
|
166
|
+
* @param {Point} position delta position of sensor base on entity position
|
167
|
+
* @param {string} name name of sensor
|
168
|
+
* @param {"rect"|"circle"} shape type of shape of physical body, ex: "rect"|"circle"
|
169
|
+
* @param {number} width width of sensor, apply when in "rect" shape
|
170
|
+
* @param {number} height height of sensor, apply when in "rect" shape
|
171
|
+
* @param {number} radius radius of sensor, apply when in "circle" shape
|
172
|
+
* @param {boolean} debug allow to show sensor for debug purpose
|
173
|
+
* @param {boolean} debugColor allow to change sensor color
|
174
|
+
* @void
|
175
|
+
*/
|
164
176
|
Entity.prototype.addSensor = function (_a, debug, debugColor) {
|
165
177
|
var position = _a.position, name = _a.name, _b = _a.shape, shape = _b === void 0 ? "rect" : _b, width = _a.width, height = _a.height, radius = _a.radius;
|
166
178
|
if (debug === void 0) { debug = false; }
|
167
179
|
name = name || genId();
|
168
|
-
var pos =
|
180
|
+
var pos = __assign({}, this.position);
|
169
181
|
var sensor;
|
170
182
|
if (shape === "rect") {
|
171
|
-
sensor = new Sensor(this, name, { width: width, height: height }, shape, Bodies.rectangle(pos.x, pos.y, width, height, {
|
183
|
+
sensor = new Sensor(this, name, position || { x: 0, y: 0 }, { width: width, height: height }, shape, Bodies.rectangle(pos.x, pos.y, width, height, {
|
172
184
|
isSensor: true,
|
173
185
|
}), debug, debugColor);
|
174
186
|
}
|
175
187
|
else {
|
176
|
-
sensor = new Sensor(this, name, { width: radius * 2, height: radius * 2 }, shape, Bodies.circle(pos.x, pos.y, radius, {
|
188
|
+
sensor = new Sensor(this, name, position || { x: 0, y: 0 }, { width: radius * 2, height: radius * 2 }, shape, Bodies.circle(pos.x, pos.y, radius, {
|
177
189
|
isSensor: true,
|
178
190
|
}), debug, debugColor);
|
179
191
|
}
|
package/lib/classes/sensor.d.ts
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
import { Color, SensorBody, Size } from "../export-types";
|
1
|
+
import { Color, Point, SensorBody, Size } from "../export-types";
|
2
2
|
import { Entity } from "./entities/entity";
|
3
3
|
export declare class Sensor {
|
4
4
|
readonly entity: Entity;
|
5
5
|
readonly name: string;
|
6
|
+
readonly position: Point;
|
6
7
|
readonly size: Size;
|
7
8
|
readonly shape: "rect" | "circle";
|
8
9
|
readonly body: SensorBody;
|
9
10
|
readonly debug: boolean;
|
10
11
|
readonly debugColor: Color;
|
11
|
-
constructor(entity: Entity, name: string, size: Size, shape: "rect" | "circle", body: SensorBody, debug?: boolean, debugColor?: Color);
|
12
|
+
constructor(entity: Entity, name: string, position: Point, size: Size, shape: "rect" | "circle", body: SensorBody, debug?: boolean, debugColor?: Color);
|
12
13
|
}
|
13
14
|
//# sourceMappingURL=sensor.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sensor.d.ts","sourceRoot":"","sources":["../../src/classes/sensor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"sensor.d.ts","sourceRoot":"","sources":["../../src/classes/sensor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,qBAAa,MAAM;aAEC,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,MAAM;aACZ,QAAQ,EAAE,KAAK;aACf,IAAI,EAAE,IAAI;aACV,KAAK,EAAE,MAAM,GAAG,QAAQ;aACxB,IAAI,EAAE,UAAU;aAChB,KAAK,EAAE,OAAO;aACd,UAAU,EAAE,KAAK;gBAPjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,KAAK,EACf,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,GAAG,QAAQ,EACxB,IAAI,EAAE,UAAU,EAChB,KAAK,GAAE,OAAe,EACtB,UAAU,GAAE,KAA4B;CAK3D"}
|
package/lib/classes/sensor.js
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
var Sensor = /** @class */ (function () {
|
2
|
-
function Sensor(entity, name, size, shape, body, debug, debugColor) {
|
2
|
+
function Sensor(entity, name, position, size, shape, body, debug, debugColor) {
|
3
3
|
if (debug === void 0) { debug = false; }
|
4
4
|
if (debugColor === void 0) { debugColor = [212, 200, 200, 100]; }
|
5
5
|
this.entity = entity;
|
6
6
|
this.name = name;
|
7
|
+
this.position = position;
|
7
8
|
this.size = size;
|
8
9
|
this.shape = shape;
|
9
10
|
this.body = body;
|
@@ -1 +1 @@
|
|
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,UAAU;IAa5B,YAAY,CAAC,MAAM,EAAE,UAAU;IAoB/B,MAAM;IAiBN,IAAI;CAmBL"}
|
@@ -194,9 +194,13 @@ var WorldManagement = /** @class */ (function () {
|
|
194
194
|
this.iterateEntities(function (entity) {
|
195
195
|
entity.update();
|
196
196
|
if (entity instanceof Entity) {
|
197
|
-
|
198
|
-
|
199
|
-
|
197
|
+
var _a = entity.position, entityX = _a.x, entityY = _a.y;
|
198
|
+
for (var _i = 0, _b = entity.sensors; _i < _b.length; _i++) {
|
199
|
+
var _c = _b[_i], body = _c.body, position = _c.position;
|
200
|
+
Body.setPosition(body, {
|
201
|
+
x: entityX + position.x,
|
202
|
+
y: entityY + position.y,
|
203
|
+
});
|
200
204
|
}
|
201
205
|
}
|
202
206
|
});
|
@@ -205,18 +209,20 @@ var WorldManagement = /** @class */ (function () {
|
|
205
209
|
this.iterateEntities(function (entity) {
|
206
210
|
entity.draw();
|
207
211
|
if (entity instanceof Entity) {
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
212
|
+
if (entity.debugSensor) {
|
213
|
+
var _loop_1 = function (sensor) {
|
214
|
+
if (sensor.debug) {
|
215
|
+
var _b = sensor.size, width_1 = _b.width, height_1 = _b.height;
|
216
|
+
Renderer.drawHandle(sensor.body.position, function (renderer) {
|
217
|
+
renderer.fill(sensor.debugColor);
|
218
|
+
renderer.rect(0, 0, width_1, height_1);
|
219
|
+
});
|
220
|
+
}
|
221
|
+
};
|
222
|
+
for (var _i = 0, _a = entity.sensors; _i < _a.length; _i++) {
|
223
|
+
var sensor = _a[_i];
|
224
|
+
_loop_1(sensor);
|
215
225
|
}
|
216
|
-
};
|
217
|
-
for (var _i = 0, _a = entity.sensors; _i < _a.length; _i++) {
|
218
|
-
var sensor = _a[_i];
|
219
|
-
_loop_1(sensor);
|
220
226
|
}
|
221
227
|
}
|
222
228
|
});
|