dacha-game-systems 0.0.2 → 0.0.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,15 +1,14 @@
1
- import { System } from 'dacha';
2
- import type { SystemOptions, UpdateOptions } from 'dacha';
3
- export declare class EffectsSystem extends System {
1
+ import { SceneSystem } from 'dacha';
2
+ import type { SceneSystemOptions, UpdateOptions } from 'dacha';
3
+ export declare class EffectsSystem extends SceneSystem {
4
4
  private scene;
5
5
  private activeEffectsCollection;
6
6
  private effectsCollection;
7
7
  private actorSpawner;
8
8
  private scripts;
9
9
  private applicatorsMap;
10
- constructor(options: SystemOptions);
11
- mount(): void;
12
- unmount(): void;
10
+ constructor(options: SceneSystemOptions);
11
+ onSceneDestroy(): void;
13
12
  private handleActorRemove;
14
13
  private handleAddEffect;
15
14
  private handleRemoveEffect;
@@ -1,9 +1,9 @@
1
- import { ActorCollection, System } from 'dacha';
1
+ import { ActorCollection, SceneSystem } from 'dacha';
2
2
  import { RemoveActor } from 'dacha/events';
3
3
  import * as EventType from '../../events';
4
4
  import { ActiveEffects, Effect } from '../../components';
5
5
  import { effectApplicators } from './effect-applicators';
6
- export class EffectsSystem extends System {
6
+ export class EffectsSystem extends SceneSystem {
7
7
  constructor(options) {
8
8
  super();
9
9
  const {
@@ -21,13 +21,11 @@ export class EffectsSystem extends System {
21
21
  this.actorSpawner = actorSpawner;
22
22
  this.scripts = resources;
23
23
  this.applicatorsMap = {};
24
- }
25
- mount() {
26
24
  this.scene.addEventListener(EventType.AddEffect, this.handleAddEffect);
27
25
  this.scene.addEventListener(EventType.RemoveEffect, this.handleRemoveEffect);
28
26
  this.activeEffectsCollection.addEventListener(RemoveActor, this.handleActorRemove);
29
27
  }
30
- unmount() {
28
+ onSceneDestroy() {
31
29
  this.scene.removeEventListener(EventType.AddEffect, this.handleAddEffect);
32
30
  this.scene.removeEventListener(EventType.RemoveEffect, this.handleRemoveEffect);
33
31
  this.activeEffectsCollection.removeEventListener(RemoveActor, this.handleActorRemove);
@@ -1,11 +1,10 @@
1
- import { System } from 'dacha';
2
- import type { SystemOptions } from 'dacha';
3
- export declare class ParallaxSystem extends System {
1
+ import { SceneSystem } from 'dacha';
2
+ import type { SceneSystemOptions } from 'dacha';
3
+ export declare class ParallaxSystem extends SceneSystem {
4
4
  private actorCollection;
5
5
  private cameraService;
6
- constructor(options: SystemOptions);
7
- mount(): void;
8
- unmount(): void;
6
+ constructor(options: SceneSystemOptions);
7
+ onSceneDestroy(): void;
9
8
  private handleAddActor;
10
9
  private setStartPosition;
11
10
  update(): void;
@@ -1,19 +1,17 @@
1
- import { ActorCollection, System, CameraService, Transform } from 'dacha';
1
+ import { ActorCollection, SceneSystem, CameraService, Transform } from 'dacha';
2
2
  import { AddActor } from 'dacha/events';
3
3
  import { Parallax } from '../../components';
4
- export class ParallaxSystem extends System {
4
+ export class ParallaxSystem extends SceneSystem {
5
5
  constructor(options) {
6
6
  super();
7
7
  this.actorCollection = new ActorCollection(options.scene, {
8
8
  components: [Transform, Parallax]
9
9
  });
10
- this.cameraService = options.scene.getService(CameraService);
11
- }
12
- mount() {
10
+ this.cameraService = options.world.getService(CameraService);
13
11
  this.actorCollection.forEach(actor => this.setStartPosition(actor));
14
12
  this.actorCollection.addEventListener(AddActor, this.handleAddActor);
15
13
  }
16
- unmount() {
14
+ onSceneDestroy() {
17
15
  this.actorCollection.removeEventListener(AddActor, this.handleAddActor);
18
16
  }
19
17
  handleAddActor = event => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dacha-game-systems",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "exports": {
5
5
  ".": {
6
6
  "require": "./build/index.js",
@@ -37,14 +37,14 @@
37
37
  "jest": "29.7.0",
38
38
  "ts-jest": "29.1.1",
39
39
  "typescript": "5.3.3",
40
- "dacha": "0.13.0",
41
- "dacha-workbench": "0.0.22",
40
+ "dacha": "0.15.0",
41
+ "dacha-workbench": "0.0.25",
42
42
  "react": "18.1.0",
43
43
  "react-dom": "18.1.0"
44
44
  },
45
45
  "peerDependencies": {
46
- "dacha": ">=0.13.0",
47
- "dacha-workbench": ">=0.0.22",
46
+ "dacha": ">=0.15.0",
47
+ "dacha-workbench": ">=0.0.25",
48
48
  "react": ">=18.1.0",
49
49
  "react-dom": ">=18.1.0"
50
50
  },