react-simple-game-engine 0.1.25 → 0.1.26
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.
@@ -4,7 +4,7 @@ import { CreateBodyDefine, EntityInitial, EntityPrepare, MasterBody, Sound } fro
|
|
4
4
|
import { EntitySult } from "./entity-sult";
|
5
5
|
import { LogicComponent } from "../logic-component";
|
6
6
|
declare type TimerJobListener = () => void;
|
7
|
-
declare type
|
7
|
+
declare type TerminateOptions = {
|
8
8
|
duration?: number;
|
9
9
|
effect: EntitySult | LogicComponent<EntitySult>;
|
10
10
|
};
|
@@ -14,7 +14,7 @@ export declare abstract class Entity<P extends Record<string, any> = Record<stri
|
|
14
14
|
private _children;
|
15
15
|
private _props;
|
16
16
|
private timerJobListeners;
|
17
|
-
private
|
17
|
+
private isTerminate;
|
18
18
|
enabledGravity: boolean;
|
19
19
|
sound?: Sound;
|
20
20
|
set sprite(sprite: Sprite<any>);
|
@@ -24,12 +24,12 @@ export declare abstract class Entity<P extends Record<string, any> = Record<stri
|
|
24
24
|
get children(): EntitySult<any>[];
|
25
25
|
get props(): P;
|
26
26
|
/**
|
27
|
-
* @param {
|
27
|
+
* @param {TerminateOptions} options
|
28
28
|
* #duration: time to disappear from the world in seconds, default: 0.2 seconds
|
29
29
|
* #effect: effect to showing on duration time
|
30
30
|
* @void
|
31
31
|
*/
|
32
|
-
|
32
|
+
terminate(options?: TerminateOptions): void;
|
33
33
|
/**
|
34
34
|
* @param {string} name
|
35
35
|
* @param {number} interval in seconds
|
@@ -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,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,UAAU,EACV,KAAK,EACN,MAAM,oBA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@class */ (function (_super) {
|
|
46
46
|
_this._children = [];
|
47
47
|
_this._props = {};
|
48
48
|
_this.timerJobListeners = {};
|
49
|
-
_this.
|
49
|
+
_this.isTerminate = false;
|
50
50
|
_this.enabledGravity = true;
|
51
51
|
return _this;
|
52
52
|
}
|
@@ -90,16 +90,16 @@ var Entity = /** @class */ (function (_super) {
|
|
90
90
|
configurable: true
|
91
91
|
});
|
92
92
|
/**
|
93
|
-
* @param {
|
93
|
+
* @param {TerminateOptions} options
|
94
94
|
* #duration: time to disappear from the world in seconds, default: 0.2 seconds
|
95
95
|
* #effect: effect to showing on duration time
|
96
96
|
* @void
|
97
97
|
*/
|
98
|
-
Entity.prototype.
|
98
|
+
Entity.prototype.terminate = function (options) {
|
99
99
|
var _this = this;
|
100
100
|
if (options) {
|
101
101
|
var _a = options.duration, duration = _a === void 0 ? 0.2 : _a, effect = options.effect;
|
102
|
-
this.
|
102
|
+
this.isTerminate = true;
|
103
103
|
Body.setVelocity(this.body, {
|
104
104
|
y: 0,
|
105
105
|
x: 0,
|
@@ -173,7 +173,7 @@ var Entity = /** @class */ (function (_super) {
|
|
173
173
|
return {};
|
174
174
|
};
|
175
175
|
Entity.prototype.update = function () {
|
176
|
-
if (this.
|
176
|
+
if (!this.isTerminate) {
|
177
177
|
this.onUpdate();
|
178
178
|
}
|
179
179
|
for (var name_1 in this.timerJobListeners) {
|