bard-legends-framework 0.11.0 → 0.12.1
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/dist/actions-performance.test.d.ts +1 -0
- package/dist/actions-performance.test.js +83 -0
- package/dist/game-entities/controller/controller.d.ts +2 -2
- package/dist/game-entities/controller/controller.js +8 -8
- package/dist/game-entities/controller/controller.test.js +2 -2
- package/dist/game-entities/entity/entity.d.ts +7 -7
- package/dist/game-entities/entity/entity.js +18 -12
- package/dist/game-entities/entity/entity.test.js +93 -30
- package/dist/game-entities/entity/helpers/entity-store.helper.d.ts +3 -3
- package/dist/game-entities/entity/helpers/entity-store.helper.js +12 -12
- package/dist/game-entities/entity/helpers/entity-store.helper.test.js +11 -11
- package/dist/game-entities/entity/helpers/entity-views.helper.d.ts +6 -6
- package/dist/game-entities/entity/helpers/entity-views.helper.js +25 -22
- package/dist/game-entities/entity/singleton-entity.test.js +9 -4
- package/dist/game-entities/hard-reset.d.ts +5 -0
- package/dist/game-entities/hard-reset.js +14 -0
- package/dist/game-entities/index.d.ts +1 -1
- package/dist/game-entities/index.js +3 -3
- package/dist/game-entities/scene/scene.d.ts +13 -13
- package/dist/game-entities/scene/scene.js +41 -46
- package/dist/game-entities/scene/scene.test.js +95 -37
- package/dist/game-entities/service/service.d.ts +1 -4
- package/dist/game-entities/service/service.js +12 -13
- package/dist/game-entities/service/service.test.js +33 -12
- package/dist/game-entities/unit-test.helper.js +1 -1
- package/dist/game-entities/update-cycle.d.ts +7 -17
- package/dist/game-entities/update-cycle.js +25 -19
- package/dist/game-entities/view/view.d.ts +6 -6
- package/dist/game-entities/view/view.js +15 -21
- package/dist/game-entities/view/view.test.js +40 -9
- package/dist/physics/entity-types/immovable-physics-entity.d.ts +1 -1
- package/dist/physics/entity-types/immovable-physics-entity.js +4 -4
- package/dist/physics/entity-types/movable-entity.d.ts +1 -1
- package/dist/physics/entity-types/movable-entity.js +2 -2
- package/dist/physics/entity-types/movable-physics-entity.d.ts +8 -8
- package/dist/physics/entity-types/movable-physics-entity.js +27 -27
- package/dist/physics/entity-types/physics-entity.d.ts +10 -14
- package/dist/physics/entity-types/physics-entity.js +27 -26
- package/dist/physics/interfaces.d.ts +6 -6
- package/dist/physics/interfaces.js +4 -4
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.d.ts +16 -16
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.js +22 -22
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.d.ts +19 -19
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.js +30 -30
- package/dist/physics/module//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +3 -3
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.d.ts +10 -10
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.js +16 -16
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.d.ts +10 -10
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.js +18 -18
- package/dist/physics/module//360/237/223/220services/collision/collisions.service.d.ts +5 -5
- package/dist/physics/module//360/237/223/220services/collision/collisions.service.js +17 -17
- package/dist/physics/module//360/237/223/220services/collision/hit-test.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/collision/hit-test.service.js +11 -11
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js +4 -4
- package/dist/physics/module//360/237/223/220services/creation/border.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/creation/border.service.js +9 -9
- package/dist/physics/module//360/237/223/220services/creation/materials.service.d.ts +7 -7
- package/dist/physics/module//360/237/223/220services/creation/materials.service.js +17 -17
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.d.ts +11 -11
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js +27 -26
- package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.js +13 -13
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js +19 -19
- package/dist/physics/module//360/237/223/220services/impact/explosion.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/impact/explosion.service.js +20 -20
- package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.d.ts +1 -1
- package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.js +4 -4
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.d.ts +2 -2
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.js +3 -3
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.d.ts +5 -5
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js +12 -12
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js +12 -12
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.d.ts +4 -4
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.js +4 -4
- package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.d.ts +1 -4
- package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.js +7 -15
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.d.ts +9 -9
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js +43 -42
- package/dist/physics/module//360/237/247/212entities/border.entity.d.ts +1 -1
- package/dist/physics/module//360/237/247/212entities/border.entity.js +3 -3
- package/dist/pixi/components/display-object-array.d.ts +5 -5
- package/dist/pixi/components/display-object-array.js +14 -14
- package/dist/pixi/components/helpers/smooth-scroller.d.ts +7 -7
- package/dist/pixi/components/helpers/smooth-scroller.js +23 -23
- package/dist/pixi/components/helpers/smooth-scroller.test.js +14 -14
- package/dist/pixi/components/menu/menu-entity.d.ts +14 -0
- package/dist/pixi/components/menu/menu-entity.js +48 -0
- package/dist/pixi/components/menu/menu.ui.d.ts +23 -0
- package/dist/pixi/components/menu/menu.ui.js +97 -0
- package/dist/pixi/components/mouse-wheel-listener.ui.d.ts +2 -2
- package/dist/pixi/components/mouse-wheel-listener.ui.js +11 -11
- package/dist/pixi/components/scroll-area.ui.d.ts +1 -1
- package/dist/pixi/components/scroll-area.ui.js +9 -9
- package/dist/pixi/components/scroll-mask.ui.d.ts +9 -8
- package/dist/pixi/components/scroll-mask.ui.js +25 -24
- package/dist/pixi/display-object/container-attributes.d.ts +24 -25
- package/dist/pixi/display-object/container-attributes.js +26 -26
- package/dist/pixi/display-object/container.d.ts +3 -3
- package/dist/pixi/display-object/container.js +2 -2
- package/dist/pixi/display-object/filters/base-filters/blur.filter.d.ts +9 -9
- package/dist/pixi/display-object/filters/base-filters/blur.filter.js +25 -25
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.d.ts +7 -7
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js +17 -17
- package/dist/pixi/display-object/filters/composite-filters/glow-filter.d.ts +6 -6
- package/dist/pixi/display-object/filters/composite-filters/glow-filter.js +10 -11
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.d.ts +2 -2
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.js +5 -5
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.d.ts +5 -5
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js +8 -8
- package/dist/pixi/display-object/filters/templates/plane.template.d.ts +5 -5
- package/dist/pixi/display-object/filters/templates/plane.template.js +7 -7
- package/dist/pixi/display-object/filters.d.ts +7 -7
- package/dist/pixi/display-object/filters.js +34 -34
- package/dist/pixi/display-object/index.d.ts +1 -1
- package/dist/pixi/display-object/objects/graphics/graphics.d.ts +9 -9
- package/dist/pixi/display-object/objects/graphics/graphics.js +25 -25
- package/dist/pixi/display-object/objects/placeholder.d.ts +1 -1
- package/dist/pixi/display-object/objects/placeholder.js +7 -7
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.d.ts +9 -9
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js +26 -25
- package/dist/pixi/display-object/objects/sprite/sprite.d.ts +10 -9
- package/dist/pixi/display-object/objects/sprite/sprite.js +62 -53
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/pixi-text-style-converter.d.ts +4 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.d.ts +6 -6
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js +16 -16
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js +28 -28
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.d.ts +1 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.js +3 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.d.ts +17 -17
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.js +62 -62
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.test.js +2 -2
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.d.ts +3 -3
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.js +6 -6
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.test.js +12 -12
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.d.ts +2 -2
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.test.js +5 -5
- package/dist/pixi/display-object/objects/text/rich-text.d.ts +0 -1
- package/dist/pixi/display-object/objects/text/rich-text.js +0 -1
- package/dist/pixi/display-object/objects/text/text.d.ts +9 -10
- package/dist/pixi/display-object/objects/text/text.js +34 -35
- package/dist/pixi/game.d.ts +20 -15
- package/dist/pixi/game.js +40 -35
- package/dist/pixi/helpers/game-assets.d.ts +5 -5
- package/dist/pixi/helpers/game-assets.js +14 -11
- package/dist/pixi/helpers/position-conversion.helper.d.ts +4 -4
- package/dist/pixi/helpers/position-conversion.helper.js +3 -3
- package/dist/pixi/index.d.ts +3 -37
- package/dist/pixi/index.js +6 -22
- package/dist/pixi/modules/CAMERA/camera.d.ts +5 -4
- package/dist/pixi/modules/CAMERA/camera.js +9 -9
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.d.ts +3 -2
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.js +1 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.d.ts +3 -2
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.js +5 -5
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.d.ts +3 -3
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.js +7 -7
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.d.ts +8 -8
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.js +8 -8
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.d.ts +2 -2
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.js +12 -12
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.d.ts +17 -16
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js +49 -48
- package/dist/pixi/pixi-definitions.d.ts +38 -0
- package/dist/pixi/pixi-definitions.js +37 -0
- package/dist/pixi/services/keyboard/keyboard.d.ts +2 -2
- package/dist/pixi/services/keyboard/keyboard.js +9 -9
- package/dist/pixi/services/mouse/mouse-target-focus.service.d.ts +10 -10
- package/dist/pixi/services/mouse/mouse-target-focus.service.js +28 -28
- package/dist/pixi/services/mouse/mouse.service.d.ts +1 -1
- package/dist/pixi/services/mouse/mouse.service.js +5 -5
- package/dist/utilities/animator/animating-content/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/animating-content/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/animating-content/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/animating-content/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/animations.d.ts +14 -6
- package/dist/utilities/animator/animations.js +15 -11
- package/dist/utilities/animator/animator/animator.d.ts +44 -0
- package/dist/utilities/animator/animator/animator.js +234 -0
- package/dist/utilities/animator/animator/animator.memory-leak.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.memory-leak.test.js +73 -0
- package/dist/utilities/animator/animator/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.performance.test.js +116 -0
- package/dist/utilities/animator/animator/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator/animator.test.js +1046 -0
- package/dist/utilities/animator/animator.d.ts +2 -3
- package/dist/utilities/animator/animator.js +66 -59
- package/dist/utilities/animator/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator.performance.test.js +46 -0
- package/dist/utilities/animator/animator.test.js +89 -28
- package/dist/utilities/animator/animator2/animator.d.ts +42 -0
- package/dist/utilities/animator/animator2/animator.js +222 -0
- package/dist/utilities/animator/animator2/animator.memory-leak.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.memory-leak.test.js +73 -0
- package/dist/utilities/animator/animator2/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.performance.test.js +65 -0
- package/dist/utilities/animator/animator2/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator2/animator.test.js +1007 -0
- package/dist/utilities/animator/animator_old/animator.d.ts +60 -0
- package/dist/utilities/animator/animator_old/animator.js +337 -0
- package/dist/utilities/animator/animator_old/animator.performance.test.d.ts +1 -0
- package/dist/utilities/animator/animator_old/animator.performance.test.js +121 -0
- package/dist/utilities/animator/animator_old/animator.test.d.ts +1 -0
- package/dist/utilities/animator/animator_old/animator.test.js +996 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.js +37 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.d.ts +38 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.js +208 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/fade-in/fade-in-state-animation.test.js +439 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.d.ts +41 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.js +107 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.js +138 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/slide-state-animation.test.js +307 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.d.ts +37 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.js +170 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/content-animations/slide/state-animation.test.js +340 -0
- package/dist/utilities/animator/index.d.ts +6 -6
- package/dist/utilities/animator/index.js +6 -6
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.d.ts +18 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.js +37 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-content.test.js +10 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.d.ts +32 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.js +168 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/fade-in/fade-in-state-animation.test.js +431 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.d.ts +37 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.js +100 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide/slide-in-content.test.js +10 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.d.ts +24 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.js +130 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.d.ts +1 -0
- package/dist/utilities/animator/state-animation/slide/slide-state-animation.test.js +301 -0
- package/dist/utilities/animator/state-animation/slide-state-animation.test.js +30 -30
- package/dist/utilities/animator/state-animation/state-animation.js +7 -7
- package/dist/utilities/animator/state-animation/state-animation.test.js +24 -24
- package/dist/utilities/animator/state-animation/visit-disappear-state-animation.test.js +30 -30
- package/dist/utilities/data-structures/vector-set/vector-set.d.ts +1 -1
- package/dist/utilities/data-structures/vector-set/vector-set.js +5 -5
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.d.ts +1 -1
- package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.js +5 -5
- package/dist/utilities/grid-algorithms/path-finder/path-finder.js +21 -21
- package/dist/utilities/grid-algorithms/path-finder/path-finder.test.js +9 -9
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.d.ts +14 -14
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.js +43 -43
- package/dist/utilities/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.js +21 -21
- package/package.json +7 -5
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StateAnimation = void 0;
|
|
4
4
|
const actions_lib_1 = require("actions-lib");
|
|
5
5
|
const animations_1 = require("../animations");
|
|
6
|
-
const animator_1 = require("../animator");
|
|
6
|
+
const animator_1 = require("../animator/animator");
|
|
7
7
|
class StateAnimation extends actions_lib_1.Attachable {
|
|
8
8
|
get currentState() {
|
|
9
9
|
return {
|
|
@@ -19,7 +19,7 @@ class StateAnimation extends actions_lib_1.Attachable {
|
|
|
19
19
|
this.animationState = 'idle';
|
|
20
20
|
this.onStateChangeAction = new actions_lib_1.Action();
|
|
21
21
|
this.onValueChangeAction = new actions_lib_1.Action();
|
|
22
|
-
this.options = { duration: 500, animation:
|
|
22
|
+
this.options = { duration: 500, animation: animations_1.Animations.lineer, ...partialOptions };
|
|
23
23
|
this.value = 0;
|
|
24
24
|
this.animator = new animator_1.Animator(this, 'value', {
|
|
25
25
|
duration: this.options.duration,
|
|
@@ -58,14 +58,14 @@ class StateAnimation extends actions_lib_1.Attachable {
|
|
|
58
58
|
this.value = 0;
|
|
59
59
|
this.onStateChangeAction.trigger({ state: this.state, nextState: this.nextState });
|
|
60
60
|
this.onValueChangeAction.trigger(this.value);
|
|
61
|
-
this.animator.animate({ value: 1 });
|
|
61
|
+
this.animator.animate({ value: 1 }).attachToRoot(); // TODO
|
|
62
62
|
}
|
|
63
63
|
break;
|
|
64
64
|
case 'transitioning':
|
|
65
65
|
if (state !== this.nextState) {
|
|
66
66
|
if (state === this.state) {
|
|
67
67
|
this.animationState = 'reverting';
|
|
68
|
-
this.animator.animate({ value: 0 }, { duration: this.value * this.options.duration });
|
|
68
|
+
this.animator.animate({ value: 0 }, { duration: this.value * this.options.duration }).attachToRoot(); // TODO
|
|
69
69
|
}
|
|
70
70
|
else {
|
|
71
71
|
this.queuedState = state;
|
|
@@ -76,7 +76,7 @@ class StateAnimation extends actions_lib_1.Attachable {
|
|
|
76
76
|
if (state !== this.state) {
|
|
77
77
|
if (state === this.nextState) {
|
|
78
78
|
this.animationState = 'transitioning';
|
|
79
|
-
this.animator.animate({ value: 1 }, { duration: (1 - this.value) * this.options.duration });
|
|
79
|
+
this.animator.animate({ value: 1 }, { duration: (1 - this.value) * this.options.duration }).attachToRoot(); // TODO
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
82
|
this.queuedState = state;
|
|
@@ -97,7 +97,7 @@ class StateAnimation extends actions_lib_1.Attachable {
|
|
|
97
97
|
this.queuedState = undefined;
|
|
98
98
|
this.value = 0;
|
|
99
99
|
this.onStateChangeAction.trigger({ state: this.state, nextState: this.nextState });
|
|
100
|
-
this.animator.animate({ value: 1 });
|
|
100
|
+
this.animator.animate({ value: 1 }).attachToRoot(); // TODO
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
103
|
this.animationState = 'idle';
|
|
@@ -118,7 +118,7 @@ class StateAnimation extends actions_lib_1.Attachable {
|
|
|
118
118
|
this.queuedState = undefined;
|
|
119
119
|
this.value = 0;
|
|
120
120
|
this.onStateChangeAction.trigger({ state: this.state, nextState: this.nextState });
|
|
121
|
-
this.animator.animate({ value: 1 });
|
|
121
|
+
this.animator.animate({ value: 1 }).attachToRoot(); // TODO
|
|
122
122
|
}
|
|
123
123
|
else {
|
|
124
124
|
this.animationState = 'idle';
|
|
@@ -9,7 +9,7 @@ const state_animation_1 = require("./state-animation");
|
|
|
9
9
|
(0, vitest_1.beforeEach)(async () => {
|
|
10
10
|
if (stateAnimation) {
|
|
11
11
|
stateAnimation.destroy();
|
|
12
|
-
|
|
12
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
13
13
|
}
|
|
14
14
|
heap = [];
|
|
15
15
|
stateAnimation = new state_animation_1.StateAnimation({ duration: 4 })
|
|
@@ -79,7 +79,7 @@ const state_animation_1 = require("./state-animation");
|
|
|
79
79
|
});
|
|
80
80
|
(0, vitest_1.test)('animation in the middle', async () => {
|
|
81
81
|
stateAnimation.setState('B');
|
|
82
|
-
|
|
82
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
83
83
|
(0, vitest_1.expect)(heap).toEqual([{ state: 'A', nextState: 'B' }, 0, 0.25]);
|
|
84
84
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
85
85
|
value: 0.25,
|
|
@@ -91,7 +91,7 @@ const state_animation_1 = require("./state-animation");
|
|
|
91
91
|
});
|
|
92
92
|
(0, vitest_1.test)('animation end', async () => {
|
|
93
93
|
stateAnimation.setState('B');
|
|
94
|
-
|
|
94
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
95
95
|
(0, vitest_1.expect)(heap).toEqual([{ state: 'A', nextState: 'B' }, 0, { state: 'B', nextState: undefined }, 0]);
|
|
96
96
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
97
97
|
value: 0,
|
|
@@ -114,7 +114,7 @@ const state_animation_1 = require("./state-animation");
|
|
|
114
114
|
});
|
|
115
115
|
(0, vitest_1.test)('instant from middle', async () => {
|
|
116
116
|
stateAnimation.setState('B');
|
|
117
|
-
|
|
117
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
118
118
|
heap = [];
|
|
119
119
|
stateAnimation.setState('B', { instant: true });
|
|
120
120
|
(0, vitest_1.expect)(heap).toEqual([{ state: 'B', nextState: undefined }, 0]);
|
|
@@ -131,7 +131,7 @@ const state_animation_1 = require("./state-animation");
|
|
|
131
131
|
(0, vitest_1.beforeEach)(async () => {
|
|
132
132
|
stateAnimation.setState('A');
|
|
133
133
|
stateAnimation.setState('B');
|
|
134
|
-
|
|
134
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
135
135
|
heap = [];
|
|
136
136
|
});
|
|
137
137
|
(0, vitest_1.test)('initial values', () => {
|
|
@@ -147,7 +147,7 @@ const state_animation_1 = require("./state-animation");
|
|
|
147
147
|
});
|
|
148
148
|
(0, vitest_1.test)('animation in the middle', async () => {
|
|
149
149
|
stateAnimation.setState('C');
|
|
150
|
-
|
|
150
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
151
151
|
(0, vitest_1.expect)(heap).toEqual([0.75]);
|
|
152
152
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
153
153
|
value: 0.75,
|
|
@@ -159,7 +159,7 @@ const state_animation_1 = require("./state-animation");
|
|
|
159
159
|
});
|
|
160
160
|
(0, vitest_1.test)('transition start', async () => {
|
|
161
161
|
stateAnimation.setState('C');
|
|
162
|
-
|
|
162
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
163
163
|
(0, vitest_1.expect)(heap).toEqual([{ state: 'B', nextState: 'C' }, 0]);
|
|
164
164
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
165
165
|
value: 0,
|
|
@@ -171,8 +171,8 @@ const state_animation_1 = require("./state-animation");
|
|
|
171
171
|
});
|
|
172
172
|
(0, vitest_1.test)('transition middle', async () => {
|
|
173
173
|
stateAnimation.setState('C');
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
175
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
176
176
|
(0, vitest_1.expect)(heap).toEqual([{ state: 'B', nextState: 'C' }, 0, 0.5]);
|
|
177
177
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
178
178
|
value: 0.5,
|
|
@@ -184,8 +184,8 @@ const state_animation_1 = require("./state-animation");
|
|
|
184
184
|
});
|
|
185
185
|
(0, vitest_1.test)('transition end', async () => {
|
|
186
186
|
stateAnimation.setState('C');
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
188
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
189
189
|
(0, vitest_1.expect)(heap).toEqual([{ state: 'B', nextState: 'C' }, 0, { state: 'C', nextState: undefined }, 0]);
|
|
190
190
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
191
191
|
value: 0,
|
|
@@ -196,11 +196,11 @@ const state_animation_1 = require("./state-animation");
|
|
|
196
196
|
});
|
|
197
197
|
});
|
|
198
198
|
(0, vitest_1.test)('queued value during reverting', async () => {
|
|
199
|
-
|
|
199
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
200
200
|
stateAnimation.setState('A');
|
|
201
|
-
|
|
201
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
202
202
|
stateAnimation.setState('C');
|
|
203
|
-
|
|
203
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
204
204
|
(0, vitest_1.expect)(heap).toEqual([0.75, 0.5, 0.25]);
|
|
205
205
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
206
206
|
value: 0.25,
|
|
@@ -210,7 +210,7 @@ const state_animation_1 = require("./state-animation");
|
|
|
210
210
|
animationState: 'reverting'
|
|
211
211
|
});
|
|
212
212
|
heap = [];
|
|
213
|
-
|
|
213
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
214
214
|
(0, vitest_1.expect)(heap).toEqual([{ state: 'A', nextState: 'C' }, 0]);
|
|
215
215
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
216
216
|
value: 0,
|
|
@@ -235,9 +235,9 @@ const state_animation_1 = require("./state-animation");
|
|
|
235
235
|
let stateAnimationNumber = new state_animation_1.StateAnimation({ duration: 4 }).attachToRoot();
|
|
236
236
|
stateAnimationNumber.setState(2, { instant: true });
|
|
237
237
|
stateAnimationNumber.setState(1);
|
|
238
|
-
|
|
238
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
239
239
|
stateAnimationNumber.setState(0);
|
|
240
|
-
|
|
240
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
241
241
|
(0, vitest_1.expect)(stateAnimationNumber.currentState).toEqual({
|
|
242
242
|
value: 0,
|
|
243
243
|
state: 1,
|
|
@@ -251,7 +251,7 @@ const state_animation_1 = require("./state-animation");
|
|
|
251
251
|
(0, vitest_1.beforeEach)(async () => {
|
|
252
252
|
stateAnimation.setState('A');
|
|
253
253
|
stateAnimation.setState('B');
|
|
254
|
-
|
|
254
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(3);
|
|
255
255
|
heap = [];
|
|
256
256
|
});
|
|
257
257
|
(0, vitest_1.test)('initial values', () => {
|
|
@@ -267,7 +267,7 @@ const state_animation_1 = require("./state-animation");
|
|
|
267
267
|
});
|
|
268
268
|
(0, vitest_1.test)('animation in the middle', async () => {
|
|
269
269
|
stateAnimation.setState('A');
|
|
270
|
-
|
|
270
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
271
271
|
(0, vitest_1.expect)(heap).toEqual([0.5]);
|
|
272
272
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
273
273
|
value: 0.5,
|
|
@@ -279,7 +279,7 @@ const state_animation_1 = require("./state-animation");
|
|
|
279
279
|
});
|
|
280
280
|
(0, vitest_1.test)('animation end', async () => {
|
|
281
281
|
stateAnimation.setState('A');
|
|
282
|
-
|
|
282
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(3);
|
|
283
283
|
(0, vitest_1.expect)(heap).toEqual([{ state: 'A', nextState: undefined }, 0]);
|
|
284
284
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
285
285
|
value: 0,
|
|
@@ -291,9 +291,9 @@ const state_animation_1 = require("./state-animation");
|
|
|
291
291
|
});
|
|
292
292
|
(0, vitest_1.test)('re-reverting', async () => {
|
|
293
293
|
stateAnimation.setState('A');
|
|
294
|
-
|
|
294
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
295
295
|
stateAnimation.setState('B');
|
|
296
|
-
|
|
296
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
297
297
|
(0, vitest_1.expect)(heap).toEqual([0.5, 0.75]);
|
|
298
298
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
299
299
|
value: 0.75,
|
|
@@ -318,10 +318,10 @@ const state_animation_1 = require("./state-animation");
|
|
|
318
318
|
let stateAnimationNumber = new state_animation_1.StateAnimation({ duration: 4 }).attachToRoot();
|
|
319
319
|
stateAnimationNumber.setState(2, { instant: true });
|
|
320
320
|
stateAnimationNumber.setState(1);
|
|
321
|
-
|
|
321
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
322
322
|
stateAnimationNumber.setState(2);
|
|
323
323
|
stateAnimationNumber.setState(0);
|
|
324
|
-
|
|
324
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
325
325
|
(0, vitest_1.expect)(stateAnimationNumber.currentState).toEqual({
|
|
326
326
|
value: 0,
|
|
327
327
|
state: 2,
|
|
@@ -9,7 +9,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
9
9
|
(0, vitest_1.beforeEach)(async () => {
|
|
10
10
|
if (stateAnimation) {
|
|
11
11
|
stateAnimation.destroy();
|
|
12
|
-
|
|
12
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
13
13
|
}
|
|
14
14
|
heap = [];
|
|
15
15
|
stateAnimation = new visit_disappear_state_animation_1.VisitDisappearStateAnimation({ duration: 4 })
|
|
@@ -39,7 +39,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
39
39
|
});
|
|
40
40
|
(0, vitest_1.test)('animation in the middle', async () => {
|
|
41
41
|
stateAnimation.setState('A');
|
|
42
|
-
|
|
42
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
43
43
|
(0, vitest_1.expect)(heap).toEqual(['A', 0.25]);
|
|
44
44
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
45
45
|
value: 0.25,
|
|
@@ -50,7 +50,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
50
50
|
});
|
|
51
51
|
(0, vitest_1.test)('animation end', async () => {
|
|
52
52
|
stateAnimation.setState('A');
|
|
53
|
-
|
|
53
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
54
54
|
(0, vitest_1.expect)(heap).toEqual(['A', 1]);
|
|
55
55
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
56
56
|
value: 1,
|
|
@@ -99,7 +99,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
99
99
|
});
|
|
100
100
|
(0, vitest_1.test)('animation in the middle', async () => {
|
|
101
101
|
stateAnimation.setState(undefined);
|
|
102
|
-
|
|
102
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
103
103
|
(0, vitest_1.expect)(heap).toEqual([0.75]);
|
|
104
104
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
105
105
|
value: 0.75,
|
|
@@ -110,7 +110,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
110
110
|
});
|
|
111
111
|
(0, vitest_1.test)('animation end', async () => {
|
|
112
112
|
stateAnimation.setState(undefined);
|
|
113
|
-
|
|
113
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
114
114
|
(0, vitest_1.expect)(heap).toEqual([undefined, 0]);
|
|
115
115
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
116
116
|
value: 0,
|
|
@@ -133,7 +133,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
133
133
|
(0, vitest_1.describe)('Cancel appearing', () => {
|
|
134
134
|
(0, vitest_1.beforeEach)(async () => {
|
|
135
135
|
stateAnimation.setState('A');
|
|
136
|
-
|
|
136
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
137
137
|
heap = [];
|
|
138
138
|
});
|
|
139
139
|
(0, vitest_1.test)('initial values', () => {
|
|
@@ -148,7 +148,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
148
148
|
});
|
|
149
149
|
(0, vitest_1.test)('animation end', async () => {
|
|
150
150
|
stateAnimation.setState(undefined);
|
|
151
|
-
|
|
151
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
152
152
|
(0, vitest_1.expect)(heap).toEqual([undefined, 0]);
|
|
153
153
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
154
154
|
value: 0,
|
|
@@ -171,9 +171,9 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
171
171
|
(0, vitest_1.describe)('Cancel disappearing', () => {
|
|
172
172
|
(0, vitest_1.beforeEach)(async () => {
|
|
173
173
|
stateAnimation.setState('A');
|
|
174
|
-
|
|
174
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
175
175
|
stateAnimation.setState(undefined);
|
|
176
|
-
|
|
176
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
177
177
|
heap = [];
|
|
178
178
|
});
|
|
179
179
|
(0, vitest_1.test)('initial values', () => {
|
|
@@ -188,7 +188,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
188
188
|
});
|
|
189
189
|
(0, vitest_1.test)('animation end', async () => {
|
|
190
190
|
stateAnimation.setState('A');
|
|
191
|
-
|
|
191
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
192
192
|
(0, vitest_1.expect)(heap).toEqual([1]);
|
|
193
193
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
194
194
|
value: 1,
|
|
@@ -222,12 +222,12 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
222
222
|
(0, vitest_1.expect)(valueChangeCalledWith).toBe('unset');
|
|
223
223
|
stateChangeCalledWith = 'unset';
|
|
224
224
|
valueChangeCalledWith = 'unset';
|
|
225
|
-
|
|
225
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
226
226
|
(0, vitest_1.expect)(stateChangeCalledWith).toBe('unset');
|
|
227
227
|
(0, vitest_1.expect)(valueChangeCalledWith).toBe(0.75);
|
|
228
228
|
stateChangeCalledWith = 'unset';
|
|
229
229
|
valueChangeCalledWith = 'unset';
|
|
230
|
-
|
|
230
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
231
231
|
(0, vitest_1.expect)(stateChangeCalledWith).toBe('unset');
|
|
232
232
|
(0, vitest_1.expect)(valueChangeCalledWith).toBe(1);
|
|
233
233
|
});
|
|
@@ -235,7 +235,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
235
235
|
(0, vitest_1.describe)('Disappear to change', () => {
|
|
236
236
|
(0, vitest_1.beforeEach)(async () => {
|
|
237
237
|
stateAnimation.setState('A');
|
|
238
|
-
|
|
238
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
239
239
|
heap = [];
|
|
240
240
|
});
|
|
241
241
|
(0, vitest_1.test)('initial values', async () => {
|
|
@@ -250,7 +250,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
250
250
|
});
|
|
251
251
|
(0, vitest_1.test)('dissapear animation in the middle', async () => {
|
|
252
252
|
stateAnimation.setState('B');
|
|
253
|
-
|
|
253
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
254
254
|
(0, vitest_1.expect)(heap).toEqual([0.75]);
|
|
255
255
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
256
256
|
value: 0.75,
|
|
@@ -261,7 +261,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
261
261
|
});
|
|
262
262
|
(0, vitest_1.test)('dissapear animation end', async () => {
|
|
263
263
|
stateAnimation.setState('B');
|
|
264
|
-
|
|
264
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
265
265
|
(0, vitest_1.expect)(heap).toEqual(['B', 0]);
|
|
266
266
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
267
267
|
value: 0,
|
|
@@ -272,8 +272,8 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
272
272
|
});
|
|
273
273
|
(0, vitest_1.test)('appear animation in the middle', async () => {
|
|
274
274
|
stateAnimation.setState('B');
|
|
275
|
-
|
|
276
|
-
|
|
275
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
276
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
277
277
|
(0, vitest_1.expect)(heap).toEqual(['B', 0, 0.25]);
|
|
278
278
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
279
279
|
value: 0.25,
|
|
@@ -284,8 +284,8 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
284
284
|
});
|
|
285
285
|
(0, vitest_1.test)('appear animation end', async () => {
|
|
286
286
|
stateAnimation.setState('B');
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
288
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
289
289
|
(0, vitest_1.expect)(heap).toEqual(['B', 0, 1]);
|
|
290
290
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
291
291
|
value: 1,
|
|
@@ -296,9 +296,9 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
296
296
|
});
|
|
297
297
|
(0, vitest_1.test)('returning back to the original state', async () => {
|
|
298
298
|
stateAnimation.setState('B');
|
|
299
|
-
|
|
299
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
300
300
|
stateAnimation.setState('A');
|
|
301
|
-
|
|
301
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
302
302
|
(0, vitest_1.expect)(heap).toEqual([0.75, 1]);
|
|
303
303
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
304
304
|
value: 1,
|
|
@@ -309,9 +309,9 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
309
309
|
});
|
|
310
310
|
(0, vitest_1.test)('edge case, changing the decition back at the moment of re-appearing', async () => {
|
|
311
311
|
stateAnimation.setState('B');
|
|
312
|
-
|
|
312
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
313
313
|
stateAnimation.setState('A');
|
|
314
|
-
|
|
314
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(1);
|
|
315
315
|
(0, vitest_1.expect)(heap).toEqual(['B', 0, 'A', 0.25]);
|
|
316
316
|
(0, vitest_1.expect)(stateAnimation.currentState).toEqual({
|
|
317
317
|
value: 0.25,
|
|
@@ -354,7 +354,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
354
354
|
});
|
|
355
355
|
(0, vitest_1.test)('Cancel appearing', async () => {
|
|
356
356
|
stateAnimation.setState('A');
|
|
357
|
-
|
|
357
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
358
358
|
heap = [];
|
|
359
359
|
stateAnimation.setState('');
|
|
360
360
|
(0, vitest_1.expect)(heap).toEqual([]);
|
|
@@ -367,9 +367,9 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
367
367
|
});
|
|
368
368
|
(0, vitest_1.test)('Cancel disappearing', async () => {
|
|
369
369
|
stateAnimation.setState('A');
|
|
370
|
-
|
|
370
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
371
371
|
stateAnimation.setState(undefined);
|
|
372
|
-
|
|
372
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
373
373
|
heap = [];
|
|
374
374
|
stateAnimation.setState('');
|
|
375
375
|
(0, vitest_1.expect)(heap).toEqual([]);
|
|
@@ -395,7 +395,7 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
395
395
|
(0, vitest_1.test)('Change disappear to change', async () => {
|
|
396
396
|
stateAnimation.setState('A', { instant: true });
|
|
397
397
|
stateAnimation.setState('B');
|
|
398
|
-
|
|
398
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(2);
|
|
399
399
|
heap = [];
|
|
400
400
|
stateAnimation.setState('');
|
|
401
401
|
(0, vitest_1.expect)(heap).toEqual([]);
|
|
@@ -412,17 +412,17 @@ const visit_disappear_state_animation_1 = require("./visit-disappear-state-anima
|
|
|
412
412
|
let consoleErrorSpy = vitest_1.vi.spyOn(console, 'error').mockImplementation(() => { });
|
|
413
413
|
stateAnimation.setState('A');
|
|
414
414
|
stateAnimation.setState(undefined);
|
|
415
|
-
|
|
415
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
416
416
|
(0, vitest_1.expect)(consoleErrorSpy).not.toBeCalled();
|
|
417
417
|
consoleErrorSpy.mockRestore();
|
|
418
418
|
});
|
|
419
419
|
(0, vitest_1.test)('completion on visible state', async () => {
|
|
420
420
|
let consoleErrorSpy = vitest_1.vi.spyOn(console, 'error').mockImplementation(() => { });
|
|
421
421
|
stateAnimation.setState('A');
|
|
422
|
-
|
|
422
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
423
423
|
stateAnimation.setState(undefined);
|
|
424
424
|
stateAnimation.setState('A');
|
|
425
|
-
|
|
425
|
+
game_entities_1.UpdateCycle.triggerUpdateTick(4);
|
|
426
426
|
(0, vitest_1.expect)(consoleErrorSpy).not.toBeCalled();
|
|
427
427
|
consoleErrorSpy.mockRestore();
|
|
428
428
|
});
|
|
@@ -3,22 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VectorSet = void 0;
|
|
4
4
|
class VectorSet {
|
|
5
5
|
constructor() {
|
|
6
|
-
this.
|
|
6
|
+
this._values = new Map();
|
|
7
7
|
}
|
|
8
8
|
add(vector) {
|
|
9
|
-
let set = this.
|
|
9
|
+
let set = this._values.get(vector.x);
|
|
10
10
|
if (!set) {
|
|
11
11
|
set = new Set();
|
|
12
|
-
this.
|
|
12
|
+
this._values.set(vector.x, set);
|
|
13
13
|
}
|
|
14
14
|
set.add(vector.y);
|
|
15
15
|
}
|
|
16
16
|
has(vector) {
|
|
17
|
-
let set = this.
|
|
17
|
+
let set = this._values.get(vector.x);
|
|
18
18
|
return set ? set.has(vector.y) : false;
|
|
19
19
|
}
|
|
20
20
|
delete(vector) {
|
|
21
|
-
let set = this.
|
|
21
|
+
let set = this._values.get(vector.x);
|
|
22
22
|
return set ? set.delete(vector.y) : false;
|
|
23
23
|
}
|
|
24
24
|
}
|
package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { Grid, Rectangle, Vector } from 'helpers-lib';
|
|
|
2
2
|
export declare class ClosestAvailableSpaceHelper {
|
|
3
3
|
static findByConvertingGridSpace(grid: Grid<boolean>, boundingBox: Rectangle, cellSize: number): Vector | undefined;
|
|
4
4
|
static find(availabilityGrid: Grid<boolean>, desiredPosition: Vector, objectSize: Vector): Vector | undefined;
|
|
5
|
-
private static
|
|
5
|
+
private static _canPlaceObject;
|
|
6
6
|
}
|
package/dist/utilities/grid-algorithms/closest-available-space/closest-available-space.helper.js
CHANGED
|
@@ -8,7 +8,7 @@ class ClosestAvailableSpaceHelper {
|
|
|
8
8
|
static findByConvertingGridSpace(grid, boundingBox, cellSize) {
|
|
9
9
|
let objectGridSize = new helpers_lib_1.Vector(Math.ceil(boundingBox.size.x / cellSize) - 1, Math.ceil(boundingBox.size.y / cellSize) - 1);
|
|
10
10
|
let objectGridArea = position_to_grid_position_converter_1.PositionToGridPositionConverter.areaToGridArea(boundingBox, cellSize);
|
|
11
|
-
if (this.
|
|
11
|
+
if (this._canPlaceObject(grid, objectGridArea)) {
|
|
12
12
|
return helpers_lib_1.Vector.zero;
|
|
13
13
|
}
|
|
14
14
|
let movePointInsideGrid = grid.movePositionInsideGrid(objectGridArea.topLeft);
|
|
@@ -23,21 +23,21 @@ class ClosestAvailableSpaceHelper {
|
|
|
23
23
|
static find(availabilityGrid, desiredPosition, objectSize) {
|
|
24
24
|
let closedPositions = new vector_set_1.VectorSet();
|
|
25
25
|
let queue = new helpers_lib_1.Queue(desiredPosition);
|
|
26
|
-
while (
|
|
26
|
+
while (queue.notEmpty) {
|
|
27
27
|
let currentPoint = queue.pop();
|
|
28
28
|
closedPositions.add(currentPoint);
|
|
29
29
|
let currentArea = new helpers_lib_1.Rectangle(currentPoint, currentPoint.add(objectSize));
|
|
30
|
-
if (this.
|
|
30
|
+
if (this._canPlaceObject(availabilityGrid, currentArea)) {
|
|
31
31
|
return helpers_lib_1.Vector.fromTo(desiredPosition, currentPoint);
|
|
32
32
|
}
|
|
33
|
-
availabilityGrid.getNeighborPositions(currentPoint, helpers_lib_1.GridNeighborType.
|
|
33
|
+
availabilityGrid.getNeighborPositions(currentPoint, helpers_lib_1.GridNeighborType.Ortogonal).forEach(nextPoint => {
|
|
34
34
|
if (!closedPositions.has(nextPoint)) {
|
|
35
35
|
queue.add(nextPoint);
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
static
|
|
40
|
+
static _canPlaceObject(grid, area) {
|
|
41
41
|
if (!grid.isAreaWithinBounds(area)) {
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
@@ -31,45 +31,45 @@ class PathfinderNode {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
class PathfinderGrid {
|
|
34
|
-
constructor(
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
40
|
-
let startingNode = new PathfinderNode(this.
|
|
41
|
-
this.
|
|
34
|
+
constructor(_grid, _startingPosition) {
|
|
35
|
+
this._grid = _grid;
|
|
36
|
+
this._startingPosition = _startingPosition;
|
|
37
|
+
this._openMinBinaryHeap = new helpers_lib_1.BinaryHeap('min');
|
|
38
|
+
this._closedNodes = [];
|
|
39
|
+
this._nodes = new helpers_lib_1.Grid({ size: _grid.size, defaultValue: undefined });
|
|
40
|
+
let startingNode = new PathfinderNode(this._startingPosition, 0, Number.MAX_SAFE_INTEGER);
|
|
41
|
+
this._openMinBinaryHeap.add(startingNode.pathLength, startingNode);
|
|
42
42
|
}
|
|
43
43
|
get hasOpenNodes() {
|
|
44
|
-
return this.
|
|
44
|
+
return this._openMinBinaryHeap.size > 0;
|
|
45
45
|
}
|
|
46
46
|
getNeighbors(node, type) {
|
|
47
|
-
return this.
|
|
47
|
+
return this._grid
|
|
48
48
|
.getNeighborPositions(node.position, type)
|
|
49
|
-
.filter(neighborPosition => this.
|
|
50
|
-
.map(neighborPosition => this.
|
|
49
|
+
.filter(neighborPosition => this._grid.get(neighborPosition))
|
|
50
|
+
.map(neighborPosition => this._nodes.get(neighborPosition) || this._createNewNode(neighborPosition));
|
|
51
51
|
}
|
|
52
52
|
popLowestPathCostNode() {
|
|
53
|
-
let lowestPathNode = this.
|
|
54
|
-
this.
|
|
53
|
+
let lowestPathNode = this._openMinBinaryHeap.pop();
|
|
54
|
+
this._openMinBinaryHeap.delete(lowestPathNode);
|
|
55
55
|
lowestPathNode.closed = true;
|
|
56
|
-
this.
|
|
56
|
+
this._closedNodes.push(lowestPathNode);
|
|
57
57
|
return lowestPathNode;
|
|
58
58
|
}
|
|
59
59
|
changeNodeCost(node, distanceFromStart, targetPosition, newParent) {
|
|
60
|
-
this.
|
|
60
|
+
this._openMinBinaryHeap.delete(node);
|
|
61
61
|
node.distanceFromStart = distanceFromStart;
|
|
62
62
|
node.distanceToEnd = node.getDistance(targetPosition);
|
|
63
63
|
node.parent = newParent;
|
|
64
|
-
this.
|
|
64
|
+
this._openMinBinaryHeap.add(node.pathLength, node);
|
|
65
65
|
}
|
|
66
66
|
getBestClosedNode() {
|
|
67
|
-
return this.
|
|
67
|
+
return this._closedNodes.reduce((prev, current) => (prev.distanceToEnd < current.distanceToEnd ? prev : current));
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
_createNewNode(position) {
|
|
70
70
|
let node = new PathfinderNode(position, Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER);
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
71
|
+
this._nodes.set(position, node);
|
|
72
|
+
this._openMinBinaryHeap.add(node.pathLength, node);
|
|
73
73
|
return node;
|
|
74
74
|
}
|
|
75
75
|
}
|