react-simple-game-engine 0.3.1 → 0.3.3

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.
@@ -1,11 +1,15 @@
1
1
  import { AnimationInitialParams } from "../../export-types";
2
2
  export declare abstract class AnimationSprite {
3
+ onCompletedCycle?: (info: {
4
+ timeCounter: number;
5
+ }) => void;
3
6
  protected currentFrame: number;
4
7
  protected _isRunning: boolean;
5
8
  protected timeCounter: number;
6
9
  private timePerFrame;
7
10
  private maxCycle;
8
11
  private cycleCounter;
12
+ get isRunning(): boolean;
9
13
  set isRunning(_isRunning: boolean);
10
14
  abstract initial(params: AnimationInitialParams): void;
11
15
  draw(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../src/classes/animations/animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,8BAAsB,eAAe;IACnC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAK;IACnC,SAAS,CAAC,UAAU,UAAQ;IAC5B,SAAS,CAAC,WAAW,SAAK;IAE1B,OAAO,CAAC,YAAY,CAAO;IAC3B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,YAAY,CAAK;IAEzB,IAAI,SAAS,CAAC,UAAU,EAAE,OAAO,EAQhC;IAED,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI;IAEtD,IAAI;IAwBJ,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,OAAO;IAC3C,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI;CAClC"}
1
+ {"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../src/classes/animations/animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,8BAAsB,eAAe;IACnC,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAE3D,SAAS,CAAC,YAAY,EAAE,MAAM,CAAK;IACnC,SAAS,CAAC,UAAU,UAAQ;IAC5B,SAAS,CAAC,WAAW,SAAK;IAE1B,OAAO,CAAC,YAAY,CAAO;IAC3B,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,YAAY,CAAK;IAEzB,IAAI,SAAS,IAIa,OAAO,CAFhC;IAED,IAAI,SAAS,CAAC,UAAU,EAAE,OAAO,EAQhC;IAED,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI;IAEtD,IAAI;IAyBJ,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,OAAO;IAC3C,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI;CAClC"}
@@ -8,6 +8,9 @@ var AnimationSprite = /** @class */ (function () {
8
8
  this.cycleCounter = 1;
9
9
  }
10
10
  Object.defineProperty(AnimationSprite.prototype, "isRunning", {
11
+ get: function () {
12
+ return this._isRunning;
13
+ },
11
14
  set: function (_isRunning) {
12
15
  this._isRunning = _isRunning;
13
16
  if (!_isRunning) {
@@ -21,6 +24,7 @@ var AnimationSprite = /** @class */ (function () {
21
24
  configurable: true
22
25
  });
23
26
  AnimationSprite.prototype.draw = function () {
27
+ var _a;
24
28
  if (this.checkFrameMax()) {
25
29
  this.currentFrame = 0;
26
30
  this.cycleCounter++;
@@ -29,6 +33,7 @@ var AnimationSprite = /** @class */ (function () {
29
33
  // if max cycle = 0, then don't care about counter, just infinite
30
34
  if (this.maxCycle) {
31
35
  if (this.cycleCounter > this.maxCycle) {
36
+ (_a = this.onCompletedCycle) === null || _a === void 0 ? void 0 : _a.call(this, { timeCounter: this.timeCounter });
32
37
  this.isRunning = false;
33
38
  }
34
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-simple-game-engine",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib",