@zylem/behaviors 0.2.0
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/README.md +26 -0
- package/dist/behavior-system-DYbx-x_-.d.ts +307 -0
- package/dist/chunk-2C3Z5GE7.js +176 -0
- package/dist/chunk-2C3Z5GE7.js.map +1 -0
- package/dist/chunk-2CLT36VB.js +241 -0
- package/dist/chunk-2CLT36VB.js.map +1 -0
- package/dist/chunk-3PYGRHAL.js +35 -0
- package/dist/chunk-3PYGRHAL.js.map +1 -0
- package/dist/chunk-4I6E6DGV.js +212 -0
- package/dist/chunk-4I6E6DGV.js.map +1 -0
- package/dist/chunk-4URF65BR.js +44 -0
- package/dist/chunk-4URF65BR.js.map +1 -0
- package/dist/chunk-6C6NXNEW.js +38 -0
- package/dist/chunk-6C6NXNEW.js.map +1 -0
- package/dist/chunk-ARJWUNRE.js +431 -0
- package/dist/chunk-ARJWUNRE.js.map +1 -0
- package/dist/chunk-BXP4K7RF.js +1205 -0
- package/dist/chunk-BXP4K7RF.js.map +1 -0
- package/dist/chunk-DYLH6K7B.js +44 -0
- package/dist/chunk-DYLH6K7B.js.map +1 -0
- package/dist/chunk-EIWQM6U3.js +27 -0
- package/dist/chunk-EIWQM6U3.js.map +1 -0
- package/dist/chunk-EZNCCO4L.js +14 -0
- package/dist/chunk-EZNCCO4L.js.map +1 -0
- package/dist/chunk-F3KRX2V4.js +457 -0
- package/dist/chunk-F3KRX2V4.js.map +1 -0
- package/dist/chunk-FPTWVCPN.js +53 -0
- package/dist/chunk-FPTWVCPN.js.map +1 -0
- package/dist/chunk-GCNRXAKH.js +37 -0
- package/dist/chunk-GCNRXAKH.js.map +1 -0
- package/dist/chunk-GYURWCIQ.js +1985 -0
- package/dist/chunk-GYURWCIQ.js.map +1 -0
- package/dist/chunk-HZMY3TT4.js +244 -0
- package/dist/chunk-HZMY3TT4.js.map +1 -0
- package/dist/chunk-ID5QJYF5.js +50 -0
- package/dist/chunk-ID5QJYF5.js.map +1 -0
- package/dist/chunk-JAN34G6S.js +552 -0
- package/dist/chunk-JAN34G6S.js.map +1 -0
- package/dist/chunk-K3UNLQ7W.js +118 -0
- package/dist/chunk-K3UNLQ7W.js.map +1 -0
- package/dist/chunk-KDY5N6J4.js +82 -0
- package/dist/chunk-KDY5N6J4.js.map +1 -0
- package/dist/chunk-KOZUNIIE.js +413 -0
- package/dist/chunk-KOZUNIIE.js.map +1 -0
- package/dist/chunk-KS72RZHX.js +30 -0
- package/dist/chunk-KS72RZHX.js.map +1 -0
- package/dist/chunk-LD5SMIB3.js +32 -0
- package/dist/chunk-LD5SMIB3.js.map +1 -0
- package/dist/chunk-OHCPV2NT.js +86 -0
- package/dist/chunk-OHCPV2NT.js.map +1 -0
- package/dist/chunk-OYWFPIHF.js +115 -0
- package/dist/chunk-OYWFPIHF.js.map +1 -0
- package/dist/chunk-POZER3MQ.js +407 -0
- package/dist/chunk-POZER3MQ.js.map +1 -0
- package/dist/chunk-RTRVBEIB.js +56 -0
- package/dist/chunk-RTRVBEIB.js.map +1 -0
- package/dist/chunk-RTVRUNYR.js +29 -0
- package/dist/chunk-RTVRUNYR.js.map +1 -0
- package/dist/chunk-SS7ELMJ7.js +406 -0
- package/dist/chunk-SS7ELMJ7.js.map +1 -0
- package/dist/chunk-STCCNLPC.js +160 -0
- package/dist/chunk-STCCNLPC.js.map +1 -0
- package/dist/chunk-SVLNF434.js +261 -0
- package/dist/chunk-SVLNF434.js.map +1 -0
- package/dist/chunk-UYFOLI2X.js +24 -0
- package/dist/chunk-UYFOLI2X.js.map +1 -0
- package/dist/chunk-VAN4WW3F.js +67 -0
- package/dist/chunk-VAN4WW3F.js.map +1 -0
- package/dist/chunk-WOMHL23C.js +369 -0
- package/dist/chunk-WOMHL23C.js.map +1 -0
- package/dist/chunk-WWVD5DR5.js +120 -0
- package/dist/chunk-WWVD5DR5.js.map +1 -0
- package/dist/chunk-XG2YMCJW.js +201 -0
- package/dist/chunk-XG2YMCJW.js.map +1 -0
- package/dist/chunk-XIJNE67Y.js +210 -0
- package/dist/chunk-XIJNE67Y.js.map +1 -0
- package/dist/chunk-Y6UJOUE5.js +44 -0
- package/dist/chunk-Y6UJOUE5.js.map +1 -0
- package/dist/chunk-YUO6SKJD.js +348 -0
- package/dist/chunk-YUO6SKJD.js.map +1 -0
- package/dist/components--hjBMTnz.d.ts +120 -0
- package/dist/components-B29WHGQN.d.ts +39 -0
- package/dist/components-BWG1GkZA.d.ts +20 -0
- package/dist/components-XCpL6IYt.d.ts +18 -0
- package/dist/components-qWwOsvwh.d.ts +43 -0
- package/dist/cooldown.d.ts +116 -0
- package/dist/cooldown.js +20 -0
- package/dist/cooldown.js.map +1 -0
- package/dist/coordinators/boundary-ricochet-3d.d.ts +19 -0
- package/dist/coordinators/boundary-ricochet-3d.js +8 -0
- package/dist/coordinators/boundary-ricochet-3d.js.map +1 -0
- package/dist/coordinators/boundary-ricochet.d.ts +34 -0
- package/dist/coordinators/boundary-ricochet.js +8 -0
- package/dist/coordinators/boundary-ricochet.js.map +1 -0
- package/dist/coordinators/first-person-shooter.d.ts +35 -0
- package/dist/coordinators/first-person-shooter.js +9 -0
- package/dist/coordinators/first-person-shooter.js.map +1 -0
- package/dist/coordinators/multidirectional-space-shooter.d.ts +27 -0
- package/dist/coordinators/multidirectional-space-shooter.js +10 -0
- package/dist/coordinators/multidirectional-space-shooter.js.map +1 -0
- package/dist/coordinators/top-down-shooter.d.ts +27 -0
- package/dist/coordinators/top-down-shooter.js +10 -0
- package/dist/coordinators/top-down-shooter.js.map +1 -0
- package/dist/core.d.ts +25 -0
- package/dist/core.js +327 -0
- package/dist/core.js.map +1 -0
- package/dist/destructible-3d.d.ts +42 -0
- package/dist/destructible-3d.js +13 -0
- package/dist/destructible-3d.js.map +1 -0
- package/dist/destructible-prebake.d.ts +28 -0
- package/dist/destructible-prebake.js +23 -0
- package/dist/destructible-prebake.js.map +1 -0
- package/dist/entity-types-CmtQ-IBp.d.ts +15 -0
- package/dist/first-person-perspective-C9Mptl0-.d.ts +23 -0
- package/dist/first-person.d.ts +204 -0
- package/dist/first-person.js +27 -0
- package/dist/first-person.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +263 -0
- package/dist/index.js.map +1 -0
- package/dist/jumper-2d.d.ts +113 -0
- package/dist/jumper-2d.js +27 -0
- package/dist/jumper-2d.js.map +1 -0
- package/dist/jumper-3d.d.ts +164 -0
- package/dist/jumper-3d.js +29 -0
- package/dist/jumper-3d.js.map +1 -0
- package/dist/moveable-BCRpjAQb.d.ts +176 -0
- package/dist/particle-emitter/presets.d.ts +46 -0
- package/dist/particle-emitter/presets.js +15 -0
- package/dist/particle-emitter/presets.js.map +1 -0
- package/dist/particle-emitter.d.ts +78 -0
- package/dist/particle-emitter.js +15 -0
- package/dist/particle-emitter.js.map +1 -0
- package/dist/payload-BQzu-oY_.d.ts +89 -0
- package/dist/platformer-3d.d.ts +347 -0
- package/dist/platformer-3d.js +23 -0
- package/dist/platformer-3d.js.map +1 -0
- package/dist/ricochet-2d.d.ts +274 -0
- package/dist/ricochet-2d.js +16 -0
- package/dist/ricochet-2d.js.map +1 -0
- package/dist/ricochet-3d.d.ts +116 -0
- package/dist/ricochet-3d.js +16 -0
- package/dist/ricochet-3d.js.map +1 -0
- package/dist/runtime-2d.d.ts +2 -0
- package/dist/runtime-2d.js +32 -0
- package/dist/runtime-2d.js.map +1 -0
- package/dist/runtime-pong.d.ts +92 -0
- package/dist/runtime-pong.js +38 -0
- package/dist/runtime-pong.js.map +1 -0
- package/dist/screen-visibility.d.ts +74 -0
- package/dist/screen-visibility.js +10 -0
- package/dist/screen-visibility.js.map +1 -0
- package/dist/screen-wrap.d.ts +86 -0
- package/dist/screen-wrap.js +16 -0
- package/dist/screen-wrap.js.map +1 -0
- package/dist/shooter-2d.d.ts +77 -0
- package/dist/shooter-2d.js +12 -0
- package/dist/shooter-2d.js.map +1 -0
- package/dist/spark-DDlIg1nM.d.ts +148 -0
- package/dist/sync-state-machine-CZyspBpj.d.ts +16 -0
- package/dist/thruster.d.ts +132 -0
- package/dist/thruster.js +26 -0
- package/dist/thruster.js.map +1 -0
- package/dist/top-down-movement.d.ts +40 -0
- package/dist/top-down-movement.js +20 -0
- package/dist/top-down-movement.js.map +1 -0
- package/dist/use-behavior-D_82jAL3.d.ts +13 -0
- package/dist/vector-Bm65-FOG.d.ts +45 -0
- package/dist/world-boundary-2d.d.ts +141 -0
- package/dist/world-boundary-2d.js +21 -0
- package/dist/world-boundary-2d.js.map +1 -0
- package/dist/world-boundary-3d.d.ts +75 -0
- package/dist/world-boundary-3d.js +21 -0
- package/dist/world-boundary-3d.js.map +1 -0
- package/package.json +161 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { F as FirstPersonInputComponent, b as FirstPersonStateComponent, a as FirstPersonMovementComponent } from './components-qWwOsvwh.js';
|
|
2
|
+
export { c as createFirstPersonInputComponent, d as createFirstPersonMovementComponent, e as createFirstPersonStateComponent } from './components-qWwOsvwh.js';
|
|
3
|
+
import { S as SyncStateMachine } from './sync-state-machine-CZyspBpj.js';
|
|
4
|
+
import { Vector3, Euler } from 'three';
|
|
5
|
+
import { F as FirstPersonPerspective } from './first-person-perspective-C9Mptl0-.js';
|
|
6
|
+
import { a as BehaviorDescriptor } from './behavior-system-DYbx-x_-.js';
|
|
7
|
+
import { i as Vec3Input } from './vector-Bm65-FOG.js';
|
|
8
|
+
import 'typescript-fsm';
|
|
9
|
+
import '@dimforge/rapier3d-compat';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* First Person Controller Finite State Machine
|
|
13
|
+
*
|
|
14
|
+
* Manages state transitions for first-person movement:
|
|
15
|
+
* - Idle: Standing still
|
|
16
|
+
* - Walking: Moving at walk speed
|
|
17
|
+
* - Running: Moving at run/sprint speed
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* First-person movement states
|
|
22
|
+
*/
|
|
23
|
+
declare enum FirstPersonState {
|
|
24
|
+
Idle = "idle",
|
|
25
|
+
Walking = "walking",
|
|
26
|
+
Running = "running"
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Events that trigger state transitions
|
|
30
|
+
*/
|
|
31
|
+
declare enum FirstPersonEvent {
|
|
32
|
+
Walk = "walk",
|
|
33
|
+
Run = "run",
|
|
34
|
+
Stop = "stop"
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Context for the FSM
|
|
38
|
+
*/
|
|
39
|
+
interface FirstPersonContext {
|
|
40
|
+
input: FirstPersonInputComponent;
|
|
41
|
+
state: FirstPersonStateComponent;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* First Person Controller FSM
|
|
45
|
+
*/
|
|
46
|
+
declare class FirstPersonFSM {
|
|
47
|
+
private ctx;
|
|
48
|
+
machine: SyncStateMachine<FirstPersonState, FirstPersonEvent, never>;
|
|
49
|
+
constructor(ctx: FirstPersonContext);
|
|
50
|
+
/** Get the current state */
|
|
51
|
+
getState(): FirstPersonState;
|
|
52
|
+
/** Dispatch an event to the FSM */
|
|
53
|
+
dispatch(event: FirstPersonEvent): void;
|
|
54
|
+
/** Get the current yaw from context */
|
|
55
|
+
getYaw(): number;
|
|
56
|
+
/** Get the current pitch from context */
|
|
57
|
+
getPitch(): number;
|
|
58
|
+
/**
|
|
59
|
+
* Update FSM based on current input and state.
|
|
60
|
+
*/
|
|
61
|
+
update(input: FirstPersonInputComponent, state: FirstPersonStateComponent): void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* First Person Controller Behavior System
|
|
66
|
+
*
|
|
67
|
+
* Handles first-person camera control and movement:
|
|
68
|
+
* - Reads input component for WASD movement and mouse look deltas
|
|
69
|
+
* - Drives a FirstPersonPerspective (yaw/pitch accumulation)
|
|
70
|
+
* - Writes velocity to transformStore (physics-based movement)
|
|
71
|
+
* - Syncs camera position from the entity's rigid body each frame
|
|
72
|
+
* - Positions an optional viewmodel entity relative to the camera
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Viewmodel configuration for an entity that follows the camera.
|
|
77
|
+
*/
|
|
78
|
+
interface ViewmodelConfig {
|
|
79
|
+
/** The entity whose visual group should be positioned relative to the camera. */
|
|
80
|
+
entity: any;
|
|
81
|
+
/** Offset from the eye position in camera-local space (right, down, forward). */
|
|
82
|
+
offset: Vector3;
|
|
83
|
+
/** Additional rotation applied to the viewmodel in local space (Euler angles in radians). */
|
|
84
|
+
rotation?: Euler;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Entity interface for first-person controller.
|
|
88
|
+
* Entities with this behavior have these components attached.
|
|
89
|
+
*/
|
|
90
|
+
interface FirstPersonEntity {
|
|
91
|
+
uuid: string;
|
|
92
|
+
body: any;
|
|
93
|
+
transformStore: any;
|
|
94
|
+
firstPerson: FirstPersonMovementComponent;
|
|
95
|
+
$fps: FirstPersonInputComponent;
|
|
96
|
+
firstPersonState: FirstPersonStateComponent;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* First Person Controller Behavior
|
|
100
|
+
*
|
|
101
|
+
* Core movement + look system for first-person cameras.
|
|
102
|
+
* Reads from entity.$fps input component and drives a FirstPersonPerspective.
|
|
103
|
+
*/
|
|
104
|
+
declare class FirstPersonControllerBehavior {
|
|
105
|
+
private world;
|
|
106
|
+
private perspectives;
|
|
107
|
+
private viewmodels;
|
|
108
|
+
constructor(world: any);
|
|
109
|
+
/**
|
|
110
|
+
* Associate a FirstPersonPerspective with an entity (by uuid).
|
|
111
|
+
* Called once by the descriptor system when the behavior is initialized.
|
|
112
|
+
*/
|
|
113
|
+
setPerspective(entityUuid: string, perspective: FirstPersonPerspective): void;
|
|
114
|
+
hasPerspective(entityUuid: string): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Attach a viewmodel (weapon/item) to an entity.
|
|
117
|
+
* The viewmodel entity's group will be positioned relative to the camera each frame.
|
|
118
|
+
*/
|
|
119
|
+
setViewmodel(entityUuid: string, config: ViewmodelConfig): void;
|
|
120
|
+
hasViewmodel(entityUuid: string): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Update one first-person entity.
|
|
123
|
+
*/
|
|
124
|
+
updateEntity(entity: any, _delta: number): void;
|
|
125
|
+
/**
|
|
126
|
+
* Update all first-person entities.
|
|
127
|
+
*/
|
|
128
|
+
update(delta: number): void;
|
|
129
|
+
/**
|
|
130
|
+
* Position a viewmodel entity relative to the camera's eye position and rotation.
|
|
131
|
+
*
|
|
132
|
+
* The physics transform system overwrites group.position from the rigid body
|
|
133
|
+
* each frame, so we must also move the body to keep them in sync.
|
|
134
|
+
*/
|
|
135
|
+
private positionViewmodel;
|
|
136
|
+
/** Cleanup */
|
|
137
|
+
destroy(): void;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* First-person controller behavior options (typed for entity.use() autocomplete).
|
|
142
|
+
*/
|
|
143
|
+
interface FirstPersonControllerOptions {
|
|
144
|
+
/** Base walking speed (default: 8) */
|
|
145
|
+
walkSpeed?: number;
|
|
146
|
+
/** Sprint/run speed (default: 16) */
|
|
147
|
+
runSpeed?: number;
|
|
148
|
+
/** Look sensitivity multiplier (default: 2) */
|
|
149
|
+
lookSensitivity?: number;
|
|
150
|
+
/** Eye height offset above entity position (default: 1.7) */
|
|
151
|
+
eyeHeight?: number;
|
|
152
|
+
/** The FirstPersonPerspective to drive (from camera.getPerspective()) */
|
|
153
|
+
perspective?: FirstPersonPerspective;
|
|
154
|
+
/** Optional viewmodel (weapon/item) to position relative to the camera */
|
|
155
|
+
viewmodel?: {
|
|
156
|
+
entity: any;
|
|
157
|
+
offset: Vec3Input;
|
|
158
|
+
rotation?: Euler;
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* FirstPersonController - typed descriptor for first-person movement and camera control.
|
|
163
|
+
*
|
|
164
|
+
* Provides complete first-person controller including:
|
|
165
|
+
* - WASD movement relative to camera yaw
|
|
166
|
+
* - Mouse look driving a FirstPersonPerspective
|
|
167
|
+
* - Optional viewmodel positioning (weapon/item following camera)
|
|
168
|
+
* - Walk/run state tracking via FSM
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* import { FirstPersonController } from "@zylem/game-lib/behavior";
|
|
173
|
+
* import { createCamera, Perspectives, FirstPersonPerspective } from "@zylem/game-lib/core";
|
|
174
|
+
* import { createActor } from "@zylem/game-lib/entity";
|
|
175
|
+
*
|
|
176
|
+
* const fpsCamera = createCamera({ perspective: Perspectives.FirstPerson, ... });
|
|
177
|
+
* const fps = fpsCamera.getPerspective<FirstPersonPerspective>();
|
|
178
|
+
*
|
|
179
|
+
* const player = createActor({ name: 'player', ... });
|
|
180
|
+
* const controller = player.use(FirstPersonController, {
|
|
181
|
+
* perspective: fps,
|
|
182
|
+
* walkSpeed: 8,
|
|
183
|
+
* runSpeed: 16,
|
|
184
|
+
* lookSensitivity: 2,
|
|
185
|
+
* });
|
|
186
|
+
*
|
|
187
|
+
* // In update loop - write input, behavior handles the rest
|
|
188
|
+
* player.onUpdate(({ inputs }) => {
|
|
189
|
+
* player.$fps.moveX = inputs.p1.axes.Horizontal.value;
|
|
190
|
+
* player.$fps.moveZ = inputs.p1.axes.Vertical.value;
|
|
191
|
+
* player.$fps.lookX = inputs.p1.axes.SecondaryHorizontal.value;
|
|
192
|
+
* player.$fps.lookY = inputs.p1.axes.SecondaryVertical.value;
|
|
193
|
+
* player.$fps.sprint = inputs.p1.shoulders.LTrigger.held > 0;
|
|
194
|
+
* });
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
declare const FirstPersonController: BehaviorDescriptor<FirstPersonControllerOptions, {
|
|
198
|
+
getState: () => FirstPersonState;
|
|
199
|
+
getYaw: () => number;
|
|
200
|
+
getPitch: () => number;
|
|
201
|
+
attachViewmodel: (entity: any, offset: Vec3Input) => void;
|
|
202
|
+
}, FirstPersonEntity>;
|
|
203
|
+
|
|
204
|
+
export { type FirstPersonContext, FirstPersonController, FirstPersonControllerBehavior, type FirstPersonControllerOptions, type FirstPersonEntity, FirstPersonEvent, FirstPersonFSM, FirstPersonInputComponent, FirstPersonMovementComponent, FirstPersonState, FirstPersonStateComponent, type ViewmodelConfig };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FirstPersonController,
|
|
3
|
+
FirstPersonControllerBehavior,
|
|
4
|
+
FirstPersonEvent,
|
|
5
|
+
FirstPersonFSM,
|
|
6
|
+
FirstPersonState
|
|
7
|
+
} from "./chunk-YUO6SKJD.js";
|
|
8
|
+
import {
|
|
9
|
+
createFirstPersonInputComponent,
|
|
10
|
+
createFirstPersonMovementComponent,
|
|
11
|
+
createFirstPersonStateComponent
|
|
12
|
+
} from "./chunk-LD5SMIB3.js";
|
|
13
|
+
import "./chunk-WWVD5DR5.js";
|
|
14
|
+
import "./chunk-RTVRUNYR.js";
|
|
15
|
+
import "./chunk-4URF65BR.js";
|
|
16
|
+
import "./chunk-EZNCCO4L.js";
|
|
17
|
+
export {
|
|
18
|
+
FirstPersonController,
|
|
19
|
+
FirstPersonControllerBehavior,
|
|
20
|
+
FirstPersonEvent,
|
|
21
|
+
FirstPersonFSM,
|
|
22
|
+
FirstPersonState,
|
|
23
|
+
createFirstPersonInputComponent,
|
|
24
|
+
createFirstPersonMovementComponent,
|
|
25
|
+
createFirstPersonStateComponent
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=first-person.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export { a as BehaviorDescriptor, d as BehaviorHandle, e as BehaviorRef, f as BehaviorSystem, h as BehaviorSystemFactory, D as DefineBehaviorConfig, p as defineBehavior } from './behavior-system-DYbx-x_-.js';
|
|
2
|
+
export { u as useBehavior } from './use-behavior-D_82jAL3.js';
|
|
3
|
+
export { P as PhysicsBodyComponent, T as TransformComponent, c as createPhysicsBodyComponent, a as createTransformComponent } from './components-BWG1GkZA.js';
|
|
4
|
+
export { T as ThrusterInputComponent, a as ThrusterMovementComponent, b as ThrusterStateComponent, c as createThrusterInputComponent, d as createThrusterMovementComponent, e as createThrusterStateComponent } from './components-B29WHGQN.js';
|
|
5
|
+
export { Behavior, PlayerInput, ThrusterBehavior, ThrusterBehaviorOptions, ThrusterEntity, ThrusterEvent, ThrusterFSM, ThrusterFSMContext, ThrusterMovementBehavior, ThrusterState } from './thruster.js';
|
|
6
|
+
export { T as TopDownMovementComponent, a as TopDownMovementInputComponent, b as TopDownMovementStateComponent, c as createTopDownMovementComponent, d as createTopDownMovementInputComponent, e as createTopDownMovementStateComponent } from './components-XCpL6IYt.js';
|
|
7
|
+
export { TopDownMovementBehavior, TopDownMovementBehaviorOptions, TopDownMovementEntity, TopDownMovementHandle, TopDownMovementRuntimeBehavior } from './top-down-movement.js';
|
|
8
|
+
export { Shooter2DBehavior, Shooter2DBehaviorOptions, Shooter2DFireArgs, Shooter2DHandle, Shooter2DProjectileFactory, Shooter2DSourceEntity, Shooter2DStageLike, Shooter2DStateComponent, Shooter2DTarget, createShooter2DStateComponent } from './shooter-2d.js';
|
|
9
|
+
export { ScreenWrapBehavior, ScreenWrapEvent, ScreenWrapFSM, ScreenWrapOptions, ScreenWrapState } from './screen-wrap.js';
|
|
10
|
+
export { ScreenVisibilityBehavior, ScreenVisibilityChangeContext, ScreenVisibilityFSM, ScreenVisibilityHandle, ScreenVisibilityOptions, ScreenVisibilitySize, ScreenVisibilitySnapshot } from './screen-visibility.js';
|
|
11
|
+
export { WorldBoundary2DBehavior, WorldBoundary2DBounds, WorldBoundary2DEvent, WorldBoundary2DFSM, WorldBoundary2DHandle, WorldBoundary2DHit, WorldBoundary2DHits, WorldBoundary2DOptions, WorldBoundary2DPosition, WorldBoundary2DState, computeWorldBoundary2DHits, hasAnyWorldBoundary2DHit } from './world-boundary-2d.js';
|
|
12
|
+
export { WorldBoundary3DBehavior, WorldBoundary3DBounds, WorldBoundary3DEvent, WorldBoundary3DFSM, WorldBoundary3DHandle, WorldBoundary3DHit, WorldBoundary3DHits, WorldBoundary3DOptions, WorldBoundary3DPosition, WorldBoundary3DState, computeWorldBoundary3DHits, hasAnyWorldBoundary3DHit } from './world-boundary-3d.js';
|
|
13
|
+
export { Ricochet2DBehavior, Ricochet2DCollisionContext, Ricochet2DEvent, Ricochet2DFSM, Ricochet2DHandle, Ricochet2DOptions, Ricochet2DResult, Ricochet2DState, RicochetCallback } from './ricochet-2d.js';
|
|
14
|
+
export { Ricochet3DBehavior, Ricochet3DCallback, Ricochet3DCollisionContext, Ricochet3DEvent, Ricochet3DFSM, Ricochet3DHandle, Ricochet3DOptions, Ricochet3DResult, Ricochet3DState } from './ricochet-3d.js';
|
|
15
|
+
export { Platformer3DBehavior, Platformer3DBehaviorOptions, Platformer3DContext, Platformer3DEntity, Platformer3DEvent, Platformer3DFSM, Platformer3DInputComponent, Platformer3DMovementBehavior, Platformer3DMovementComponent, Platformer3DState, Platformer3DStateComponent, PlatformerCollisionContext, createPlatformer3DInputComponent, createPlatformer3DMovementComponent, createPlatformer3DStateComponent } from './platformer-3d.js';
|
|
16
|
+
export { F as FirstPersonInputComponent, a as FirstPersonMovementComponent, b as FirstPersonStateComponent, c as createFirstPersonInputComponent, d as createFirstPersonMovementComponent, e as createFirstPersonStateComponent } from './components-qWwOsvwh.js';
|
|
17
|
+
export { FirstPersonContext, FirstPersonController, FirstPersonControllerBehavior, FirstPersonControllerOptions, FirstPersonEntity, FirstPersonEvent, FirstPersonFSM, FirstPersonState, ViewmodelConfig } from './first-person.js';
|
|
18
|
+
export { J as JumpConfig3D, a as JumpContext3D, b as JumpInput3D, c as JumpState3D, V as Vec3Like, d as createJumpConfig3D, e as createJumpInput3D, f as createJumpState3D } from './components--hjBMTnz.js';
|
|
19
|
+
export { Jumper3D, Jumper3DBehavior, Jumper3DBehaviorOptions, Jumper3DEntity, Jumper3DEvent, Jumper3DFSM, Jumper3DState, JumperTickEvent, JumperTickResult } from './jumper-3d.js';
|
|
20
|
+
export { JumpConfig2D, JumpContext2D, JumpInput2D, JumpState2D, Jumper2D, Jumper2DBehavior, Jumper2DBehaviorOptions, Jumper2DEntity, Jumper2DEvent, Jumper2DFSM, Jumper2DState, Jumper2DTickEvent, Jumper2DTickResult, createJumpConfig2D, createJumpInput2D, createJumpState2D } from './jumper-2d.js';
|
|
21
|
+
export { CooldownBehavior, CooldownConfig, CooldownEntry, CooldownHandle, CooldownOptions, fireCooldown, getCooldown, getCooldownStore, registerCooldown, resetCooldown, tickCooldowns } from './cooldown.js';
|
|
22
|
+
export { Destructible3DBehavior, Destructible3DBehaviorOptions, Destructible3DColliderOptions, Destructible3DFragmentColliderShape, Destructible3DFragmentPhysicsOptions, Destructible3DHandle, FractureOptionsInput } from './destructible-3d.js';
|
|
23
|
+
export { DestructibleMesh, FractureOptions, VoronoiOptions } from '@dgreenheck/three-pinata';
|
|
24
|
+
export { D as DestructiblePrebakeWorkerAPI, P as PlainBufferGeometryPayload, a as PlainFractureOptions, c as PrebakeWorkerRequest, d as PrebakeWorkerResponse } from './payload-BQzu-oY_.js';
|
|
25
|
+
export { BurstParticlePresetOptions, ParticleEmitterBehavior, ParticleEmitterBehaviorOptions, ParticleEmitterHandle, particlePresets } from './particle-emitter.js';
|
|
26
|
+
export { BoundaryRicochetCoordinator } from './coordinators/boundary-ricochet.js';
|
|
27
|
+
export { BoundaryRicochet3DCoordinator } from './coordinators/boundary-ricochet-3d.js';
|
|
28
|
+
export { FirstPersonShooterCoordinator, FirstPersonShooterInput } from './coordinators/first-person-shooter.js';
|
|
29
|
+
export { TopDownShooterCoordinator, TopDownShooterInput } from './coordinators/top-down-shooter.js';
|
|
30
|
+
export { MultidirectionalSpaceShooterCoordinator, MultidirectionalSpaceShooterInput } from './coordinators/multidirectional-space-shooter.js';
|
|
31
|
+
export { P as ParticleEffectDefinition, a as ParticleMagicAgency, b as ParticleMagicAlignment, c as ParticleMagicModifierInput, d as ParticleMagicModifierOptions, e as ParticleMagicOrder, f as ParticleMagicRealityEffect, g as ParticleMagicTemperament, h as ParticlePresetMaterialOptions, S as SemanticParticlePresetOptions, u as particleEffect } from './spark-DDlIg1nM.js';
|
|
32
|
+
import '@dimforge/rapier3d-compat';
|
|
33
|
+
import 'three';
|
|
34
|
+
import './sync-state-machine-CZyspBpj.js';
|
|
35
|
+
import 'typescript-fsm';
|
|
36
|
+
import './vector-Bm65-FOG.js';
|
|
37
|
+
import './entity-types-CmtQ-IBp.js';
|
|
38
|
+
import './first-person-perspective-C9Mptl0-.js';
|
|
39
|
+
import 'three.quarks';
|
|
40
|
+
import './moveable-BCRpjAQb.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FirstPersonShooterCoordinator
|
|
3
|
+
} from "./chunk-VAN4WW3F.js";
|
|
4
|
+
import {
|
|
5
|
+
MultidirectionalSpaceShooterCoordinator
|
|
6
|
+
} from "./chunk-RTRVBEIB.js";
|
|
7
|
+
import {
|
|
8
|
+
TopDownShooterCoordinator
|
|
9
|
+
} from "./chunk-FPTWVCPN.js";
|
|
10
|
+
import "./chunk-6C6NXNEW.js";
|
|
11
|
+
import {
|
|
12
|
+
ScreenWrapBehavior,
|
|
13
|
+
ScreenWrapEvent,
|
|
14
|
+
ScreenWrapFSM,
|
|
15
|
+
ScreenWrapState
|
|
16
|
+
} from "./chunk-XIJNE67Y.js";
|
|
17
|
+
import {
|
|
18
|
+
Shooter2DBehavior,
|
|
19
|
+
createShooter2DStateComponent
|
|
20
|
+
} from "./chunk-STCCNLPC.js";
|
|
21
|
+
import {
|
|
22
|
+
ThrusterBehavior,
|
|
23
|
+
ThrusterEvent,
|
|
24
|
+
ThrusterFSM,
|
|
25
|
+
ThrusterMovementBehavior,
|
|
26
|
+
ThrusterState
|
|
27
|
+
} from "./chunk-2CLT36VB.js";
|
|
28
|
+
import {
|
|
29
|
+
createThrusterInputComponent,
|
|
30
|
+
createThrusterMovementComponent,
|
|
31
|
+
createThrusterStateComponent
|
|
32
|
+
} from "./chunk-KS72RZHX.js";
|
|
33
|
+
import {
|
|
34
|
+
TopDownMovementBehavior,
|
|
35
|
+
TopDownMovementRuntimeBehavior
|
|
36
|
+
} from "./chunk-OYWFPIHF.js";
|
|
37
|
+
import {
|
|
38
|
+
createTopDownMovementComponent,
|
|
39
|
+
createTopDownMovementInputComponent,
|
|
40
|
+
createTopDownMovementStateComponent
|
|
41
|
+
} from "./chunk-EIWQM6U3.js";
|
|
42
|
+
import "./chunk-ID5QJYF5.js";
|
|
43
|
+
import {
|
|
44
|
+
WorldBoundary2DBehavior,
|
|
45
|
+
WorldBoundary2DEvent,
|
|
46
|
+
WorldBoundary2DFSM,
|
|
47
|
+
WorldBoundary2DState,
|
|
48
|
+
computeWorldBoundary2DHits,
|
|
49
|
+
hasAnyWorldBoundary2DHit
|
|
50
|
+
} from "./chunk-XG2YMCJW.js";
|
|
51
|
+
import {
|
|
52
|
+
WorldBoundary3DBehavior,
|
|
53
|
+
WorldBoundary3DEvent,
|
|
54
|
+
WorldBoundary3DFSM,
|
|
55
|
+
WorldBoundary3DState,
|
|
56
|
+
computeWorldBoundary3DHits,
|
|
57
|
+
hasAnyWorldBoundary3DHit
|
|
58
|
+
} from "./chunk-4I6E6DGV.js";
|
|
59
|
+
import {
|
|
60
|
+
BoundaryRicochetCoordinator
|
|
61
|
+
} from "./chunk-GCNRXAKH.js";
|
|
62
|
+
import "./chunk-KDY5N6J4.js";
|
|
63
|
+
import {
|
|
64
|
+
BoundaryRicochet3DCoordinator
|
|
65
|
+
} from "./chunk-3PYGRHAL.js";
|
|
66
|
+
import "./chunk-OHCPV2NT.js";
|
|
67
|
+
import {
|
|
68
|
+
ParticleEmitterBehavior,
|
|
69
|
+
particlePresets
|
|
70
|
+
} from "./chunk-POZER3MQ.js";
|
|
71
|
+
import {
|
|
72
|
+
particleEffect
|
|
73
|
+
} from "./chunk-GYURWCIQ.js";
|
|
74
|
+
import {
|
|
75
|
+
Platformer3DBehavior,
|
|
76
|
+
Platformer3DBehavior2,
|
|
77
|
+
Platformer3DEvent,
|
|
78
|
+
Platformer3DFSM,
|
|
79
|
+
Platformer3DState,
|
|
80
|
+
createPlatformer3DInputComponent,
|
|
81
|
+
createPlatformer3DMovementComponent,
|
|
82
|
+
createPlatformer3DStateComponent
|
|
83
|
+
} from "./chunk-JAN34G6S.js";
|
|
84
|
+
import {
|
|
85
|
+
Ricochet2DBehavior,
|
|
86
|
+
Ricochet2DEvent,
|
|
87
|
+
Ricochet2DFSM,
|
|
88
|
+
Ricochet2DState
|
|
89
|
+
} from "./chunk-KOZUNIIE.js";
|
|
90
|
+
import {
|
|
91
|
+
Ricochet3DBehavior,
|
|
92
|
+
Ricochet3DEvent,
|
|
93
|
+
Ricochet3DFSM,
|
|
94
|
+
Ricochet3DState
|
|
95
|
+
} from "./chunk-ARJWUNRE.js";
|
|
96
|
+
import {
|
|
97
|
+
ScreenVisibilityBehavior,
|
|
98
|
+
ScreenVisibilityFSM
|
|
99
|
+
} from "./chunk-WOMHL23C.js";
|
|
100
|
+
import {
|
|
101
|
+
createPhysicsBodyComponent,
|
|
102
|
+
createTransformComponent,
|
|
103
|
+
useBehavior
|
|
104
|
+
} from "./chunk-UYFOLI2X.js";
|
|
105
|
+
import "./chunk-Y6UJOUE5.js";
|
|
106
|
+
import {
|
|
107
|
+
CooldownBehavior,
|
|
108
|
+
fireCooldown,
|
|
109
|
+
getCooldown,
|
|
110
|
+
getCooldownStore,
|
|
111
|
+
registerCooldown,
|
|
112
|
+
resetCooldown,
|
|
113
|
+
tickCooldowns
|
|
114
|
+
} from "./chunk-K3UNLQ7W.js";
|
|
115
|
+
import {
|
|
116
|
+
Destructible3DBehavior,
|
|
117
|
+
DestructibleMesh,
|
|
118
|
+
FractureOptions
|
|
119
|
+
} from "./chunk-BXP4K7RF.js";
|
|
120
|
+
import "./chunk-HZMY3TT4.js";
|
|
121
|
+
import {
|
|
122
|
+
FirstPersonController,
|
|
123
|
+
FirstPersonControllerBehavior,
|
|
124
|
+
FirstPersonEvent,
|
|
125
|
+
FirstPersonFSM,
|
|
126
|
+
FirstPersonState
|
|
127
|
+
} from "./chunk-YUO6SKJD.js";
|
|
128
|
+
import {
|
|
129
|
+
createFirstPersonInputComponent,
|
|
130
|
+
createFirstPersonMovementComponent,
|
|
131
|
+
createFirstPersonStateComponent
|
|
132
|
+
} from "./chunk-LD5SMIB3.js";
|
|
133
|
+
import "./chunk-WWVD5DR5.js";
|
|
134
|
+
import {
|
|
135
|
+
Jumper2D,
|
|
136
|
+
Jumper2DBehavior,
|
|
137
|
+
Jumper2DEvent,
|
|
138
|
+
Jumper2DFSM,
|
|
139
|
+
Jumper2DState,
|
|
140
|
+
Jumper2DTickEvent,
|
|
141
|
+
createJumpConfig2D,
|
|
142
|
+
createJumpInput2D,
|
|
143
|
+
createJumpState2D
|
|
144
|
+
} from "./chunk-SS7ELMJ7.js";
|
|
145
|
+
import {
|
|
146
|
+
Jumper3D,
|
|
147
|
+
Jumper3DBehavior,
|
|
148
|
+
Jumper3DEvent,
|
|
149
|
+
Jumper3DFSM,
|
|
150
|
+
Jumper3DState,
|
|
151
|
+
JumperTickEvent
|
|
152
|
+
} from "./chunk-F3KRX2V4.js";
|
|
153
|
+
import {
|
|
154
|
+
createJumpConfig3D,
|
|
155
|
+
createJumpInput3D,
|
|
156
|
+
createJumpState3D
|
|
157
|
+
} from "./chunk-DYLH6K7B.js";
|
|
158
|
+
import "./chunk-SVLNF434.js";
|
|
159
|
+
import "./chunk-RTVRUNYR.js";
|
|
160
|
+
import "./chunk-4URF65BR.js";
|
|
161
|
+
import {
|
|
162
|
+
defineBehavior
|
|
163
|
+
} from "./chunk-EZNCCO4L.js";
|
|
164
|
+
export {
|
|
165
|
+
BoundaryRicochet3DCoordinator,
|
|
166
|
+
BoundaryRicochetCoordinator,
|
|
167
|
+
CooldownBehavior,
|
|
168
|
+
Destructible3DBehavior,
|
|
169
|
+
DestructibleMesh,
|
|
170
|
+
FirstPersonController,
|
|
171
|
+
FirstPersonControllerBehavior,
|
|
172
|
+
FirstPersonEvent,
|
|
173
|
+
FirstPersonFSM,
|
|
174
|
+
FirstPersonShooterCoordinator,
|
|
175
|
+
FirstPersonState,
|
|
176
|
+
FractureOptions,
|
|
177
|
+
Jumper2D,
|
|
178
|
+
Jumper2DBehavior,
|
|
179
|
+
Jumper2DEvent,
|
|
180
|
+
Jumper2DFSM,
|
|
181
|
+
Jumper2DState,
|
|
182
|
+
Jumper2DTickEvent,
|
|
183
|
+
Jumper3D,
|
|
184
|
+
Jumper3DBehavior,
|
|
185
|
+
Jumper3DEvent,
|
|
186
|
+
Jumper3DFSM,
|
|
187
|
+
Jumper3DState,
|
|
188
|
+
JumperTickEvent,
|
|
189
|
+
MultidirectionalSpaceShooterCoordinator,
|
|
190
|
+
ParticleEmitterBehavior,
|
|
191
|
+
Platformer3DBehavior2 as Platformer3DBehavior,
|
|
192
|
+
Platformer3DEvent,
|
|
193
|
+
Platformer3DFSM,
|
|
194
|
+
Platformer3DBehavior as Platformer3DMovementBehavior,
|
|
195
|
+
Platformer3DState,
|
|
196
|
+
Ricochet2DBehavior,
|
|
197
|
+
Ricochet2DEvent,
|
|
198
|
+
Ricochet2DFSM,
|
|
199
|
+
Ricochet2DState,
|
|
200
|
+
Ricochet3DBehavior,
|
|
201
|
+
Ricochet3DEvent,
|
|
202
|
+
Ricochet3DFSM,
|
|
203
|
+
Ricochet3DState,
|
|
204
|
+
ScreenVisibilityBehavior,
|
|
205
|
+
ScreenVisibilityFSM,
|
|
206
|
+
ScreenWrapBehavior,
|
|
207
|
+
ScreenWrapEvent,
|
|
208
|
+
ScreenWrapFSM,
|
|
209
|
+
ScreenWrapState,
|
|
210
|
+
Shooter2DBehavior,
|
|
211
|
+
ThrusterBehavior,
|
|
212
|
+
ThrusterEvent,
|
|
213
|
+
ThrusterFSM,
|
|
214
|
+
ThrusterMovementBehavior,
|
|
215
|
+
ThrusterState,
|
|
216
|
+
TopDownMovementBehavior,
|
|
217
|
+
TopDownMovementRuntimeBehavior,
|
|
218
|
+
TopDownShooterCoordinator,
|
|
219
|
+
WorldBoundary2DBehavior,
|
|
220
|
+
WorldBoundary2DEvent,
|
|
221
|
+
WorldBoundary2DFSM,
|
|
222
|
+
WorldBoundary2DState,
|
|
223
|
+
WorldBoundary3DBehavior,
|
|
224
|
+
WorldBoundary3DEvent,
|
|
225
|
+
WorldBoundary3DFSM,
|
|
226
|
+
WorldBoundary3DState,
|
|
227
|
+
computeWorldBoundary2DHits,
|
|
228
|
+
computeWorldBoundary3DHits,
|
|
229
|
+
createFirstPersonInputComponent,
|
|
230
|
+
createFirstPersonMovementComponent,
|
|
231
|
+
createFirstPersonStateComponent,
|
|
232
|
+
createJumpConfig2D,
|
|
233
|
+
createJumpConfig3D,
|
|
234
|
+
createJumpInput2D,
|
|
235
|
+
createJumpInput3D,
|
|
236
|
+
createJumpState2D,
|
|
237
|
+
createJumpState3D,
|
|
238
|
+
createPhysicsBodyComponent,
|
|
239
|
+
createPlatformer3DInputComponent,
|
|
240
|
+
createPlatformer3DMovementComponent,
|
|
241
|
+
createPlatformer3DStateComponent,
|
|
242
|
+
createShooter2DStateComponent,
|
|
243
|
+
createThrusterInputComponent,
|
|
244
|
+
createThrusterMovementComponent,
|
|
245
|
+
createThrusterStateComponent,
|
|
246
|
+
createTopDownMovementComponent,
|
|
247
|
+
createTopDownMovementInputComponent,
|
|
248
|
+
createTopDownMovementStateComponent,
|
|
249
|
+
createTransformComponent,
|
|
250
|
+
defineBehavior,
|
|
251
|
+
fireCooldown,
|
|
252
|
+
getCooldown,
|
|
253
|
+
getCooldownStore,
|
|
254
|
+
hasAnyWorldBoundary2DHit,
|
|
255
|
+
hasAnyWorldBoundary3DHit,
|
|
256
|
+
particleEffect,
|
|
257
|
+
particlePresets,
|
|
258
|
+
registerCooldown,
|
|
259
|
+
resetCooldown,
|
|
260
|
+
tickCooldowns,
|
|
261
|
+
useBehavior
|
|
262
|
+
};
|
|
263
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { S as SyncStateMachine } from './sync-state-machine-CZyspBpj.js';
|
|
2
|
+
import { a as BehaviorDescriptor } from './behavior-system-DYbx-x_-.js';
|
|
3
|
+
import 'typescript-fsm';
|
|
4
|
+
|
|
5
|
+
interface JumpConfig2D {
|
|
6
|
+
jumpHeight: number;
|
|
7
|
+
gravity: number;
|
|
8
|
+
maxFallSpeed?: number;
|
|
9
|
+
maxJumps: number;
|
|
10
|
+
resetJumpsOnGround: boolean;
|
|
11
|
+
coyoteTimeMs: number;
|
|
12
|
+
jumpBufferMs: number;
|
|
13
|
+
minTimeBetweenJumpsMs?: number;
|
|
14
|
+
variableJump?: {
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
cutGravityMultiplier: number;
|
|
17
|
+
maxHoldMs?: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
declare function createJumpConfig2D(options?: Partial<JumpConfig2D>): JumpConfig2D;
|
|
21
|
+
interface JumpInput2D {
|
|
22
|
+
jumpPressed: boolean;
|
|
23
|
+
jumpHeld: boolean;
|
|
24
|
+
jumpReleased: boolean;
|
|
25
|
+
fastFall?: boolean;
|
|
26
|
+
}
|
|
27
|
+
declare function createJumpInput2D(): JumpInput2D;
|
|
28
|
+
interface JumpContext2D {
|
|
29
|
+
dt: number;
|
|
30
|
+
velocityY: number;
|
|
31
|
+
isGrounded: boolean;
|
|
32
|
+
timeSinceGroundedMs: number;
|
|
33
|
+
setVerticalVelocity(y: number): void;
|
|
34
|
+
}
|
|
35
|
+
interface JumpState2D {
|
|
36
|
+
jumpsUsed: number;
|
|
37
|
+
lastJumpTimeMs: number;
|
|
38
|
+
bufferedJumpMs: number;
|
|
39
|
+
coyoteMs: number;
|
|
40
|
+
isJumping: boolean;
|
|
41
|
+
jumpHoldMs: number;
|
|
42
|
+
jumpCutApplied: boolean;
|
|
43
|
+
}
|
|
44
|
+
declare function createJumpState2D(): JumpState2D;
|
|
45
|
+
|
|
46
|
+
declare enum Jumper2DTickEvent {
|
|
47
|
+
None = "none",
|
|
48
|
+
Jump = "jump",
|
|
49
|
+
Fall = "fall",
|
|
50
|
+
Land = "land"
|
|
51
|
+
}
|
|
52
|
+
interface Jumper2DTickResult {
|
|
53
|
+
event: Jumper2DTickEvent;
|
|
54
|
+
}
|
|
55
|
+
declare class Jumper2DBehavior {
|
|
56
|
+
tick(config: JumpConfig2D, input: JumpInput2D, ctx: JumpContext2D, state: JumpState2D): Jumper2DTickResult;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare enum Jumper2DState {
|
|
60
|
+
Grounded = "grounded",
|
|
61
|
+
Jumping = "jumping",
|
|
62
|
+
Falling = "falling"
|
|
63
|
+
}
|
|
64
|
+
declare enum Jumper2DEvent {
|
|
65
|
+
Jump = "jump",
|
|
66
|
+
Fall = "fall",
|
|
67
|
+
Land = "land"
|
|
68
|
+
}
|
|
69
|
+
interface Jumper2DFSMContext {
|
|
70
|
+
state: JumpState2D;
|
|
71
|
+
}
|
|
72
|
+
declare class Jumper2DFSM {
|
|
73
|
+
private ctx;
|
|
74
|
+
machine: SyncStateMachine<Jumper2DState, Jumper2DEvent, never>;
|
|
75
|
+
constructor(ctx: Jumper2DFSMContext);
|
|
76
|
+
getState(): Jumper2DState;
|
|
77
|
+
dispatch(event: Jumper2DEvent): void;
|
|
78
|
+
isJumping(): boolean;
|
|
79
|
+
isGrounded(): boolean;
|
|
80
|
+
getJumpsUsed(): number;
|
|
81
|
+
applyTickEvent(tickEvent: string, isGrounded: boolean): void;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface Jumper2DBehaviorOptions {
|
|
85
|
+
jumpHeight?: number;
|
|
86
|
+
gravity?: number;
|
|
87
|
+
maxFallSpeed?: number;
|
|
88
|
+
maxJumps?: number;
|
|
89
|
+
resetJumpsOnGround?: boolean;
|
|
90
|
+
coyoteTimeMs?: number;
|
|
91
|
+
jumpBufferMs?: number;
|
|
92
|
+
minTimeBetweenJumpsMs?: number;
|
|
93
|
+
variableJump?: JumpConfig2D['variableJump'];
|
|
94
|
+
groundRayLength?: number;
|
|
95
|
+
snapToGroundDistance?: number;
|
|
96
|
+
debugGroundProbe?: boolean;
|
|
97
|
+
}
|
|
98
|
+
interface Jumper2DEntity {
|
|
99
|
+
uuid: string;
|
|
100
|
+
body: any;
|
|
101
|
+
transformStore: any;
|
|
102
|
+
jumper2d: JumpConfig2D;
|
|
103
|
+
$jumper2d: JumpInput2D;
|
|
104
|
+
jumper2dState: JumpState2D;
|
|
105
|
+
}
|
|
106
|
+
declare const Jumper2D: BehaviorDescriptor<Jumper2DBehaviorOptions, {
|
|
107
|
+
getState: () => Jumper2DState;
|
|
108
|
+
isJumping: () => boolean;
|
|
109
|
+
getJumpsUsed: () => number;
|
|
110
|
+
getJumpsRemaining: () => number;
|
|
111
|
+
}, Jumper2DEntity>;
|
|
112
|
+
|
|
113
|
+
export { type JumpConfig2D, type JumpContext2D, type JumpInput2D, type JumpState2D, Jumper2D, Jumper2DBehavior, type Jumper2DBehaviorOptions, type Jumper2DEntity, Jumper2DEvent, Jumper2DFSM, Jumper2DState, Jumper2DTickEvent, type Jumper2DTickResult, createJumpConfig2D, createJumpInput2D, createJumpState2D };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Jumper2D,
|
|
3
|
+
Jumper2DBehavior,
|
|
4
|
+
Jumper2DEvent,
|
|
5
|
+
Jumper2DFSM,
|
|
6
|
+
Jumper2DState,
|
|
7
|
+
Jumper2DTickEvent,
|
|
8
|
+
createJumpConfig2D,
|
|
9
|
+
createJumpInput2D,
|
|
10
|
+
createJumpState2D
|
|
11
|
+
} from "./chunk-SS7ELMJ7.js";
|
|
12
|
+
import "./chunk-SVLNF434.js";
|
|
13
|
+
import "./chunk-RTVRUNYR.js";
|
|
14
|
+
import "./chunk-4URF65BR.js";
|
|
15
|
+
import "./chunk-EZNCCO4L.js";
|
|
16
|
+
export {
|
|
17
|
+
Jumper2D,
|
|
18
|
+
Jumper2DBehavior,
|
|
19
|
+
Jumper2DEvent,
|
|
20
|
+
Jumper2DFSM,
|
|
21
|
+
Jumper2DState,
|
|
22
|
+
Jumper2DTickEvent,
|
|
23
|
+
createJumpConfig2D,
|
|
24
|
+
createJumpInput2D,
|
|
25
|
+
createJumpState2D
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=jumper-2d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|