gaesup-world 0.9.0 → 0.9.5

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.
Files changed (269) hide show
  1. package/dist/gaesup/animation/actions.d.ts +37 -0
  2. package/dist/gaesup/animation/actions.js +117 -0
  3. package/dist/gaesup/camera/control/normal.d.ts +4 -0
  4. package/dist/gaesup/camera/control/normal.js +15 -0
  5. package/dist/gaesup/camera/control/orbit.d.ts +4 -0
  6. package/dist/gaesup/camera/control/orbit.js +22 -0
  7. package/dist/gaesup/camera/index.d.ts +2 -0
  8. package/dist/gaesup/camera/index.js +24 -0
  9. package/dist/gaesup/camera/type.d.ts +14 -0
  10. package/dist/gaesup/camera/type.js +1 -0
  11. package/dist/gaesup/component/active/airplane/index.d.ts +2 -0
  12. package/dist/gaesup/component/active/airplane/index.js +16 -0
  13. package/dist/gaesup/component/active/airplane/type.d.ts +3 -0
  14. package/dist/gaesup/component/active/airplane/type.js +1 -0
  15. package/dist/gaesup/component/active/character/index.d.ts +8 -0
  16. package/dist/gaesup/component/active/character/index.js +17 -0
  17. package/dist/gaesup/component/active/character/type.d.ts +12 -0
  18. package/dist/gaesup/component/active/character/type.js +1 -0
  19. package/dist/gaesup/component/active/vehicle/index.d.ts +2 -0
  20. package/dist/gaesup/component/active/vehicle/index.js +16 -0
  21. package/dist/gaesup/component/active/vehicle/type.d.ts +3 -0
  22. package/dist/gaesup/component/active/vehicle/type.js +1 -0
  23. package/dist/gaesup/component/index.d.ts +5 -0
  24. package/dist/gaesup/component/index.js +28 -0
  25. package/dist/gaesup/component/inner/airplane/index.d.ts +2 -0
  26. package/dist/gaesup/component/inner/airplane/index.js +18 -0
  27. package/dist/gaesup/component/inner/airplane/type.d.ts +5 -0
  28. package/dist/gaesup/component/inner/airplane/type.js +1 -0
  29. package/dist/gaesup/component/inner/character/index.d.ts +2 -0
  30. package/dist/gaesup/component/inner/character/index.js +18 -0
  31. package/dist/gaesup/component/inner/character/type.d.ts +10 -0
  32. package/dist/gaesup/component/inner/character/type.js +1 -0
  33. package/dist/gaesup/component/inner/common/InnerGroupRef.d.ts +13 -0
  34. package/dist/gaesup/component/inner/common/InnerGroupRef.js +18 -0
  35. package/dist/gaesup/component/inner/common/OuterGroupRef.d.ts +5 -0
  36. package/dist/gaesup/component/inner/common/OuterGroupRef.js +6 -0
  37. package/dist/gaesup/component/inner/common/RigidbodyRef.d.ts +36 -0
  38. package/dist/gaesup/component/inner/common/RigidbodyRef.js +97 -0
  39. package/dist/gaesup/component/inner/common/calc.d.ts +7 -0
  40. package/dist/gaesup/component/inner/common/calc.js +15 -0
  41. package/dist/gaesup/component/inner/common/partsGroupRef.d.ts +8 -0
  42. package/dist/gaesup/component/inner/common/partsGroupRef.js +44 -0
  43. package/dist/gaesup/component/inner/common/setGroundRay.d.ts +2 -0
  44. package/dist/gaesup/component/inner/common/setGroundRay.js +14 -0
  45. package/dist/gaesup/component/inner/common/type.d.ts +61 -0
  46. package/dist/gaesup/component/inner/common/type.js +1 -0
  47. package/dist/gaesup/component/inner/rider/index.d.ts +10 -0
  48. package/dist/gaesup/component/inner/rider/index.js +33 -0
  49. package/dist/gaesup/component/inner/vehicle/collider.d.ts +9 -0
  50. package/dist/gaesup/component/inner/vehicle/collider.js +19 -0
  51. package/dist/gaesup/component/inner/vehicle/index.d.ts +2 -0
  52. package/dist/gaesup/component/inner/vehicle/index.js +21 -0
  53. package/dist/gaesup/component/inner/vehicle/type.d.ts +5 -0
  54. package/dist/gaesup/component/inner/vehicle/type.js +1 -0
  55. package/dist/gaesup/component/inner/vehicle/wheels.d.ts +8 -0
  56. package/dist/gaesup/component/inner/vehicle/wheels.js +58 -0
  57. package/dist/gaesup/component/passive/airplane/index.d.ts +2 -0
  58. package/dist/gaesup/component/passive/airplane/index.js +48 -0
  59. package/dist/gaesup/component/passive/airplane/type.d.ts +2 -0
  60. package/dist/gaesup/component/passive/airplane/type.js +1 -0
  61. package/dist/gaesup/component/passive/character/index.d.ts +2 -0
  62. package/dist/gaesup/component/passive/character/index.js +37 -0
  63. package/dist/gaesup/component/passive/character/type.d.ts +2 -0
  64. package/dist/gaesup/component/passive/character/type.js +1 -0
  65. package/dist/gaesup/component/passive/type.d.ts +37 -0
  66. package/dist/gaesup/component/passive/type.js +1 -0
  67. package/dist/gaesup/component/passive/vehicle/index.d.ts +2 -0
  68. package/dist/gaesup/component/passive/vehicle/index.js +32 -0
  69. package/dist/gaesup/component/passive/vehicle/type.d.ts +2 -0
  70. package/dist/gaesup/component/passive/vehicle/type.js +1 -0
  71. package/dist/gaesup/component/type.d.ts +18 -0
  72. package/dist/gaesup/component/type.js +1 -0
  73. package/dist/gaesup/controller/context/index.d.ts +48 -0
  74. package/dist/gaesup/controller/context/index.js +59 -0
  75. package/dist/gaesup/controller/context/reducer.d.ts +12 -0
  76. package/dist/gaesup/controller/context/reducer.js +21 -0
  77. package/dist/gaesup/controller/context/type.d.ts +39 -0
  78. package/dist/gaesup/controller/context/type.js +1 -0
  79. package/dist/gaesup/controller/debug/airplane.d.ts +71 -0
  80. package/dist/gaesup/controller/debug/airplane.js +71 -0
  81. package/dist/gaesup/controller/debug/character.d.ts +27 -0
  82. package/dist/gaesup/controller/debug/character.js +27 -0
  83. package/dist/gaesup/controller/debug/index.d.ts +6 -0
  84. package/dist/gaesup/controller/debug/index.js +49 -0
  85. package/dist/gaesup/controller/debug/vehicle.d.ts +27 -0
  86. package/dist/gaesup/controller/debug/vehicle.js +27 -0
  87. package/dist/gaesup/controller/index.d.ts +3 -0
  88. package/dist/gaesup/controller/index.js +75 -0
  89. package/dist/gaesup/controller/initialize/callback/index.d.ts +15 -0
  90. package/dist/gaesup/controller/initialize/callback/index.js +69 -0
  91. package/dist/gaesup/controller/initialize/callback/type.d.ts +24 -0
  92. package/dist/gaesup/controller/initialize/callback/type.js +1 -0
  93. package/dist/gaesup/controller/initialize/index.d.ts +10 -0
  94. package/dist/gaesup/controller/initialize/index.js +88 -0
  95. package/dist/gaesup/controller/style.css +48 -0
  96. package/dist/gaesup/controller/type.d.ts +104 -0
  97. package/dist/gaesup/controller/type.js +1 -0
  98. package/dist/gaesup/gaesupProps/index.d.ts +6 -0
  99. package/dist/gaesup/gaesupProps/index.js +50 -0
  100. package/dist/gaesup/hooks/useClicker/index.d.ts +4 -0
  101. package/dist/gaesup/hooks/useClicker/index.js +28 -0
  102. package/dist/gaesup/hooks/useFocus/index.d.ts +23 -0
  103. package/dist/gaesup/hooks/useFocus/index.js +190 -0
  104. package/dist/gaesup/hooks/useGaesupAnimation/index.d.ts +10 -0
  105. package/dist/gaesup/hooks/useGaesupAnimation/index.js +95 -0
  106. package/dist/gaesup/hooks/useGaesupController/index.d.ts +9 -0
  107. package/dist/gaesup/hooks/useGaesupController/index.js +14 -0
  108. package/dist/gaesup/hooks/useGaesupGltf/index.d.ts +26 -0
  109. package/dist/gaesup/hooks/useGaesupGltf/index.js +73 -0
  110. package/dist/gaesup/hooks/useJoyStick/index.d.ts +39 -0
  111. package/dist/gaesup/hooks/useJoyStick/index.js +61 -0
  112. package/dist/gaesup/hooks/useMovePoint/index.d.ts +4 -0
  113. package/dist/gaesup/hooks/useMovePoint/index.js +27 -0
  114. package/dist/gaesup/hooks/usePushKey/index.d.ts +3 -0
  115. package/dist/gaesup/hooks/usePushKey/index.js +29 -0
  116. package/dist/gaesup/hooks/useRideable/index.d.ts +20 -0
  117. package/dist/gaesup/hooks/useRideable/index.js +162 -0
  118. package/dist/gaesup/hooks/useRideable/type.d.ts +19 -0
  119. package/dist/gaesup/hooks/useRideable/type.js +1 -0
  120. package/dist/gaesup/hooks/useTeleport/index.d.ts +4 -0
  121. package/dist/gaesup/hooks/useTeleport/index.js +16 -0
  122. package/dist/gaesup/hooks/useZoom/index.d.ts +3 -0
  123. package/dist/gaesup/hooks/useZoom/index.js +18 -0
  124. package/dist/gaesup/physics/airplane/damping.d.ts +2 -0
  125. package/dist/gaesup/physics/airplane/damping.js +5 -0
  126. package/dist/gaesup/physics/airplane/direction.d.ts +2 -0
  127. package/dist/gaesup/physics/airplane/direction.js +65 -0
  128. package/dist/gaesup/physics/airplane/gravity.d.ts +2 -0
  129. package/dist/gaesup/physics/airplane/gravity.js +6 -0
  130. package/dist/gaesup/physics/airplane/impulse.d.ts +2 -0
  131. package/dist/gaesup/physics/airplane/impulse.js +17 -0
  132. package/dist/gaesup/physics/airplane/index.d.ts +2 -0
  133. package/dist/gaesup/physics/airplane/index.js +14 -0
  134. package/dist/gaesup/physics/airplane/innerCalc.d.ts +2 -0
  135. package/dist/gaesup/physics/airplane/innerCalc.js +27 -0
  136. package/dist/gaesup/physics/airplane/landing.d.ts +2 -0
  137. package/dist/gaesup/physics/airplane/landing.js +29 -0
  138. package/dist/gaesup/physics/character/direction.d.ts +5 -0
  139. package/dist/gaesup/physics/character/direction.js +62 -0
  140. package/dist/gaesup/physics/character/impulse.d.ts +2 -0
  141. package/dist/gaesup/physics/character/impulse.js +26 -0
  142. package/dist/gaesup/physics/character/index.d.ts +2 -0
  143. package/dist/gaesup/physics/character/index.js +12 -0
  144. package/dist/gaesup/physics/character/innerCalc.d.ts +2 -0
  145. package/dist/gaesup/physics/character/innerCalc.js +12 -0
  146. package/dist/gaesup/physics/character/queue.d.ts +2 -0
  147. package/dist/gaesup/physics/character/queue.js +48 -0
  148. package/dist/gaesup/physics/character/stop.d.ts +2 -0
  149. package/dist/gaesup/physics/character/stop.js +8 -0
  150. package/dist/gaesup/physics/check/ground.d.ts +2 -0
  151. package/dist/gaesup/physics/check/ground.js +23 -0
  152. package/dist/gaesup/physics/check/index.d.ts +2 -0
  153. package/dist/gaesup/physics/check/index.js +12 -0
  154. package/dist/gaesup/physics/check/moving.d.ts +2 -0
  155. package/dist/gaesup/physics/check/moving.js +23 -0
  156. package/dist/gaesup/physics/check/push.d.ts +2 -0
  157. package/dist/gaesup/physics/check/push.js +6 -0
  158. package/dist/gaesup/physics/check/riding.d.ts +2 -0
  159. package/dist/gaesup/physics/check/riding.js +7 -0
  160. package/dist/gaesup/physics/check/rotate.d.ts +2 -0
  161. package/dist/gaesup/physics/check/rotate.js +8 -0
  162. package/dist/gaesup/physics/index.d.ts +7 -0
  163. package/dist/gaesup/physics/index.js +67 -0
  164. package/dist/gaesup/physics/type.d.ts +42 -0
  165. package/dist/gaesup/physics/type.js +2 -0
  166. package/dist/gaesup/physics/vehicle/damping.d.ts +2 -0
  167. package/dist/gaesup/physics/vehicle/damping.js +6 -0
  168. package/dist/gaesup/physics/vehicle/direction.d.ts +4 -0
  169. package/dist/gaesup/physics/vehicle/direction.js +30 -0
  170. package/dist/gaesup/physics/vehicle/impulse.d.ts +2 -0
  171. package/dist/gaesup/physics/vehicle/impulse.js +25 -0
  172. package/dist/gaesup/physics/vehicle/index.d.ts +2 -0
  173. package/dist/gaesup/physics/vehicle/index.js +12 -0
  174. package/dist/gaesup/physics/vehicle/innerCalc.d.ts +2 -0
  175. package/dist/gaesup/physics/vehicle/innerCalc.js +7 -0
  176. package/dist/gaesup/physics/vehicle/landing.d.ts +2 -0
  177. package/dist/gaesup/physics/vehicle/landing.js +29 -0
  178. package/dist/gaesup/tools/MiniMap/default.d.ts +9 -0
  179. package/dist/gaesup/tools/MiniMap/default.js +9 -0
  180. package/dist/gaesup/tools/MiniMap/index.d.ts +2 -0
  181. package/dist/gaesup/tools/MiniMap/index.js +76 -0
  182. package/dist/gaesup/tools/MiniMap/style.css +243 -0
  183. package/dist/gaesup/tools/MiniMap/type.d.ts +30 -0
  184. package/dist/gaesup/tools/MiniMap/type.js +1 -0
  185. package/dist/gaesup/tools/clicker/index.d.ts +5 -0
  186. package/dist/gaesup/tools/clicker/index.js +23 -0
  187. package/dist/gaesup/tools/gameboy/GameBoyButton.d.ts +9 -0
  188. package/dist/gaesup/tools/gameboy/GameBoyButton.js +16 -0
  189. package/dist/gaesup/tools/gameboy/index.d.ts +8 -0
  190. package/dist/gaesup/tools/gameboy/index.js +22 -0
  191. package/dist/gaesup/tools/gameboy/style.css +92 -0
  192. package/dist/gaesup/tools/gameboy/type.d.ts +4 -0
  193. package/dist/gaesup/tools/gameboy/type.js +1 -0
  194. package/dist/gaesup/tools/gamepad/GamePadButton.d.ts +8 -0
  195. package/dist/gaesup/tools/gamepad/GamePadButton.js +21 -0
  196. package/dist/gaesup/tools/gamepad/index.d.ts +6 -0
  197. package/dist/gaesup/tools/gamepad/index.js +34 -0
  198. package/dist/gaesup/tools/gamepad/style.css +61 -0
  199. package/dist/gaesup/tools/gamepad/type.d.ts +6 -0
  200. package/dist/gaesup/tools/gamepad/type.js +1 -0
  201. package/dist/gaesup/tools/joystick/index.d.ts +3 -0
  202. package/dist/gaesup/tools/joystick/index.js +169 -0
  203. package/dist/gaesup/tools/joystick/style.css +38 -0
  204. package/dist/gaesup/tools/joystick/type.d.ts +23 -0
  205. package/dist/gaesup/tools/joystick/type.js +1 -0
  206. package/dist/gaesup/tools/jumpPortal/index.d.ts +9 -0
  207. package/dist/gaesup/tools/jumpPortal/index.js +10 -0
  208. package/dist/gaesup/tools/jumpPortal/style.css +16 -0
  209. package/dist/gaesup/tools/keyBoardToolTip/constant.d.ts +402 -0
  210. package/dist/gaesup/tools/keyBoardToolTip/constant.js +122 -0
  211. package/dist/gaesup/tools/keyBoardToolTip/default.d.ts +10 -0
  212. package/dist/gaesup/tools/keyBoardToolTip/default.js +12 -0
  213. package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +3 -0
  214. package/dist/gaesup/tools/keyBoardToolTip/index.js +71 -0
  215. package/dist/gaesup/tools/keyBoardToolTip/style.css +24 -0
  216. package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +37 -0
  217. package/dist/gaesup/tools/keyBoardToolTip/type.js +1 -0
  218. package/dist/gaesup/tools/rideable/index.d.ts +3 -0
  219. package/dist/gaesup/tools/rideable/index.js +76 -0
  220. package/dist/gaesup/tools/rideable/style.css +16 -0
  221. package/dist/gaesup/tools/rideable/type.d.ts +25 -0
  222. package/dist/gaesup/tools/rideable/type.js +1 -0
  223. package/dist/gaesup/tools/type.d.ts +2 -0
  224. package/dist/gaesup/tools/type.js +1 -0
  225. package/dist/gaesup/tools/zoomButton/index.d.ts +0 -0
  226. package/dist/gaesup/tools/zoomButton/index.js +102 -0
  227. package/dist/gaesup/tools/zoomButton/style.css +16 -0
  228. package/dist/gaesup/utils/context.d.ts +2 -0
  229. package/dist/gaesup/utils/context.js +3 -0
  230. package/dist/gaesup/utils/debug.d.ts +30 -0
  231. package/dist/gaesup/utils/debug.js +36 -0
  232. package/dist/gaesup/utils/getTag.d.ts +3 -0
  233. package/dist/gaesup/utils/getTag.js +4 -0
  234. package/dist/gaesup/utils/index.d.ts +3 -0
  235. package/dist/gaesup/utils/index.js +3 -0
  236. package/dist/gaesup/utils/innerHtml.d.ts +4 -0
  237. package/dist/gaesup/utils/innerHtml.js +41 -0
  238. package/dist/gaesup/utils/ray.d.ts +6 -0
  239. package/dist/gaesup/utils/ray.js +7 -0
  240. package/dist/gaesup/utils/ref.d.ts +2 -0
  241. package/dist/gaesup/utils/ref.js +16 -0
  242. package/dist/gaesup/utils/type.d.ts +5 -0
  243. package/dist/gaesup/utils/type.js +1 -0
  244. package/dist/gaesup/utils/vector.d.ts +11 -0
  245. package/dist/gaesup/utils/vector.js +38 -0
  246. package/dist/gaesup/world/context/index.d.ts +5 -0
  247. package/dist/gaesup/world/context/index.js +136 -0
  248. package/dist/gaesup/world/context/reducer.d.ts +27 -0
  249. package/dist/gaesup/world/context/reducer.js +21 -0
  250. package/dist/gaesup/world/context/type.d.ts +187 -0
  251. package/dist/gaesup/world/context/type.js +1 -0
  252. package/dist/gaesup/world/debug/cameraOption.d.ts +47 -0
  253. package/dist/gaesup/world/debug/cameraOption.js +47 -0
  254. package/dist/gaesup/world/debug/index.d.ts +6 -0
  255. package/dist/gaesup/world/debug/index.js +32 -0
  256. package/dist/gaesup/world/debug/mode.d.ts +10 -0
  257. package/dist/gaesup/world/debug/mode.js +10 -0
  258. package/dist/gaesup/world/index.d.ts +3 -0
  259. package/dist/gaesup/world/index.js +9 -0
  260. package/dist/gaesup/world/initalize/index.d.ts +32 -0
  261. package/dist/gaesup/world/initalize/index.js +60 -0
  262. package/dist/gaesup/world/style.css +13 -0
  263. package/dist/gaesup/world/type.d.ts +20 -0
  264. package/dist/gaesup/world/type.js +1 -0
  265. package/dist/index.d.ts +26 -0
  266. package/dist/index.js +26 -0
  267. package/index.ts +1 -1
  268. package/package.json +29 -28
  269. package/pnpm-lock.yaml +0 -4003
@@ -0,0 +1,37 @@
1
+ import { Ref } from "react";
2
+ import * as THREE from "three";
3
+ import { AnimationAction, AnimationClip, AnimationMixer, Object3D, Object3DEventMap } from "three";
4
+ import { groundRayType } from "../controller/type";
5
+ export type Api<T extends AnimationClip> = {
6
+ ref: React.MutableRefObject<Object3D | undefined | null>;
7
+ clips: AnimationClip[];
8
+ mixer: AnimationMixer;
9
+ names: T["name"][];
10
+ actions: {
11
+ [key in T["name"]]: AnimationAction | null;
12
+ };
13
+ };
14
+ export type playActionsType = {
15
+ type: "character" | "vehicle" | "airplane";
16
+ currentAnimation?: string;
17
+ actions: actionsType;
18
+ animationRef: Ref<Object3D<Object3DEventMap>>;
19
+ isActive: boolean;
20
+ };
21
+ export type subscribeActionsType = {
22
+ type: "character" | "vehicle" | "airplane";
23
+ groundRay: groundRayType;
24
+ animations: AnimationClip[];
25
+ };
26
+ export type actionsType = {
27
+ [x: string]: THREE.AnimationAction | null;
28
+ };
29
+ export type playResultType = {
30
+ actions: actionsType;
31
+ ref: Ref<Object3D<Object3DEventMap>>;
32
+ };
33
+ export declare function subscribeActions({ type }: subscribeActionsType): void;
34
+ export default function playActions({ type, actions, animationRef, currentAnimation, isActive, }: playActionsType): {
35
+ animationRef: Ref<THREE.Object3D<THREE.Object3DEventMap>>;
36
+ currentAnimation: string;
37
+ };
@@ -0,0 +1,117 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { useFrame } from "@react-three/fiber";
13
+ import { useContext, useEffect } from "react";
14
+ import { useGaesupAnimation } from "../hooks/useGaesupAnimation";
15
+ import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/context";
16
+ export function subscribeActions(_a) {
17
+ var type = _a.type;
18
+ var states = useContext(GaesupWorldContext).states;
19
+ var subscribeAll = useGaesupAnimation({ type: type }).subscribeAll;
20
+ // 초기 기본 애니메이션 등록
21
+ useEffect(function () {
22
+ subscribeAll([
23
+ {
24
+ tag: "walk",
25
+ condition: function () { return !states.isRunning && states.isMoving; },
26
+ action: function () { },
27
+ animationName: "walk",
28
+ key: "walk",
29
+ },
30
+ {
31
+ tag: "run",
32
+ condition: function () { return states.isRunning; },
33
+ action: function () { },
34
+ animationName: "run",
35
+ key: "run",
36
+ },
37
+ {
38
+ tag: "jump",
39
+ condition: function () { return states.isJumping; },
40
+ action: function () { },
41
+ animationName: "jump",
42
+ key: "jump",
43
+ },
44
+ {
45
+ tag: "ride",
46
+ condition: function () { return states.isPush["keyR"]; },
47
+ action: function () { },
48
+ animationName: "ride",
49
+ key: "ride",
50
+ },
51
+ {
52
+ tag: "land",
53
+ condition: function () { return states.isLanding; },
54
+ action: function () { },
55
+ animationName: "land",
56
+ key: "land",
57
+ },
58
+ {
59
+ tag: "fall",
60
+ condition: function () { return states.isFalling; },
61
+ action: function () { },
62
+ animationName: "fall",
63
+ key: "fall",
64
+ },
65
+ ]);
66
+ }, []);
67
+ }
68
+ export default function playActions(_a) {
69
+ var _b, _c;
70
+ var type = _a.type, actions = _a.actions, animationRef = _a.animationRef, currentAnimation = _a.currentAnimation, isActive = _a.isActive;
71
+ var _d = useContext(GaesupWorldContext), mode = _d.mode, animationState = _d.animationState, block = _d.block;
72
+ var dispatch = useContext(GaesupWorldDispatchContext);
73
+ var _e = useGaesupAnimation({ type: type }), notify = _e.notify, store = _e.store;
74
+ if (isActive) {
75
+ currentAnimation = (_b = animationState === null || animationState === void 0 ? void 0 : animationState[type]) === null || _b === void 0 ? void 0 : _b.current;
76
+ }
77
+ var play = function (tag) {
78
+ animationState[type].current = tag;
79
+ var currentAnimation = store[tag];
80
+ if (currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.action) {
81
+ currentAnimation.action();
82
+ }
83
+ dispatch({
84
+ type: "update",
85
+ payload: {
86
+ animationState: __assign({}, animationState),
87
+ },
88
+ });
89
+ };
90
+ useEffect(function () {
91
+ var _a;
92
+ var animation = "idle";
93
+ if (block.animation) {
94
+ animation = "idle";
95
+ }
96
+ else if (currentAnimation) {
97
+ animation = currentAnimation;
98
+ }
99
+ else if (animationState[type].current) {
100
+ animation = animationState[type].current;
101
+ }
102
+ var action = (_a = actions[animation]) === null || _a === void 0 ? void 0 : _a.reset().fadeIn(0.2).play();
103
+ return function () {
104
+ action === null || action === void 0 ? void 0 : action.fadeOut(0.2);
105
+ };
106
+ }, [currentAnimation, mode.type, block.animation, type]);
107
+ useFrame(function () {
108
+ if (isActive) {
109
+ var tag = notify();
110
+ play(tag);
111
+ }
112
+ });
113
+ return {
114
+ animationRef: animationRef,
115
+ currentAnimation: (_c = animationState === null || animationState === void 0 ? void 0 : animationState[type]) === null || _c === void 0 ? void 0 : _c.current,
116
+ };
117
+ }
@@ -0,0 +1,4 @@
1
+ import { cameraPropType } from "../../physics/type";
2
+ import { activeStateType, cameraOptionType } from "../../world/context/type";
3
+ export declare const makeNormalCameraPosition: (activeState: activeStateType, cameraOption: cameraOptionType) => import("three").Vector3;
4
+ export default function normal(prop: cameraPropType): void;
@@ -0,0 +1,15 @@
1
+ import { V3 } from "../../utils/vector";
2
+ export var makeNormalCameraPosition = function (activeState, cameraOption) {
3
+ var XDistance = cameraOption.XDistance, YDistance = cameraOption.YDistance, ZDistance = cameraOption.ZDistance;
4
+ var cameraPosition = activeState.position
5
+ .clone()
6
+ .add(V3(XDistance, YDistance, ZDistance));
7
+ return cameraPosition;
8
+ };
9
+ export default function normal(prop) {
10
+ var state = prop.state, cameraOption = prop.worldContext.cameraOption, lerp = prop.controllerOptions.lerp;
11
+ if (!state || !state.camera)
12
+ return;
13
+ state.camera.position.lerp(cameraOption.position.clone(), lerp.cameraPosition);
14
+ state.camera.lookAt(cameraOption.target);
15
+ }
@@ -0,0 +1,4 @@
1
+ import { cameraPropType } from "../../physics/type";
2
+ import { activeStateType, cameraOptionType } from "../../world/context/type";
3
+ export declare const makeOrbitCameraPosition: (activeState: activeStateType, cameraOption: cameraOptionType) => import("three").Vector3;
4
+ export default function orbit(prop: cameraPropType): void;
@@ -0,0 +1,22 @@
1
+ import { quat } from "@react-three/rapier";
2
+ import { V3 } from "../../utils/vector";
3
+ export var makeOrbitCameraPosition = function (activeState, cameraOption) {
4
+ var XDistance = cameraOption.XDistance, YDistance = cameraOption.YDistance, ZDistance = cameraOption.ZDistance;
5
+ var cameraPosition = activeState.position.clone().add(V3(Math.sin(activeState.euler.y), 1, Math.cos(activeState.euler.y))
6
+ .normalize()
7
+ .clone()
8
+ .multiply(V3(-XDistance, YDistance, -ZDistance)));
9
+ return cameraPosition;
10
+ };
11
+ export default function orbit(prop) {
12
+ var state = prop.state, _a = prop.worldContext, activeState = _a.activeState, cameraOption = _a.cameraOption, lerp = prop.controllerOptions.lerp;
13
+ if (!state || !state.camera)
14
+ return;
15
+ var cameraPosition = makeOrbitCameraPosition(activeState, cameraOption);
16
+ state.camera.position.lerp(cameraPosition.clone(), lerp.cameraTurn);
17
+ state.camera.quaternion.copy(activeState.quat
18
+ .clone()
19
+ .multiply(quat().setFromAxisAngle(V3(0, 1, 0), Math.PI)));
20
+ state.camera.rotation.copy(activeState.euler);
21
+ state.camera.lookAt(activeState.position.clone());
22
+ }
@@ -0,0 +1,2 @@
1
+ import { cameraPropType } from "../physics/type";
2
+ export default function Camera(prop: cameraPropType): void;
@@ -0,0 +1,24 @@
1
+ import { useFrame } from "@react-three/fiber";
2
+ import normal, { makeNormalCameraPosition } from "./control/normal";
3
+ import orbit from "./control/orbit";
4
+ export default function Camera(prop) {
5
+ useFrame(function (state) {
6
+ prop.state = state;
7
+ if (!prop.worldContext.block.camera) {
8
+ if (prop.worldContext.mode.control === "orbit") {
9
+ orbit(prop);
10
+ }
11
+ else if (prop.worldContext.mode.control === "normal") {
12
+ normal(prop);
13
+ }
14
+ }
15
+ });
16
+ // 포커스가 아닐 때 카메라 activeStae 따라가기
17
+ useFrame(function () {
18
+ if (!prop.worldContext.cameraOption.focus) {
19
+ prop.worldContext.cameraOption.target =
20
+ prop.worldContext.activeState.position;
21
+ prop.worldContext.cameraOption.position = makeNormalCameraPosition(prop.worldContext.activeState, prop.worldContext.cameraOption);
22
+ }
23
+ });
24
+ }
@@ -0,0 +1,14 @@
1
+ import * as THREE from "three";
2
+ export type cameraRayType = {
3
+ origin: THREE.Vector3;
4
+ hit: THREE.Raycaster;
5
+ rayCast: THREE.Raycaster | null;
6
+ length: number;
7
+ dir: THREE.Vector3;
8
+ position: THREE.Vector3;
9
+ intersects: THREE.Intersection<THREE.Mesh>[];
10
+ detected: THREE.Intersection<THREE.Mesh>[];
11
+ intersectObjectMap: {
12
+ [uuid: string]: THREE.Mesh;
13
+ };
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { activeAirplaneInnerType } from "./type";
2
+ export declare function AirplaneRef(props: activeAirplaneInnerType): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { AirplaneInnerRef } from "../../inner/airplane";
14
+ export function AirplaneRef(props) {
15
+ return (_jsx(AirplaneInnerRef, __assign({ name: "airplane", isActive: true, currentAnimation: "idle", componentType: "airplane", ridingUrl: props.ridingUrl }, props, { children: props.children })));
16
+ }
@@ -0,0 +1,3 @@
1
+ import { passiveAirplanePropsType } from "../../passive/airplane/type";
2
+ import { innerRefType } from "../../passive/type";
3
+ export type activeAirplaneInnerType = passiveAirplanePropsType & innerRefType;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { controllerInnerType, refsType } from "../../../controller/type";
2
+ import { urlsType } from "../../../world/context/type";
3
+ export declare function CharacterRef({ children, props, refs, urls, }: {
4
+ children: React.ReactNode;
5
+ props: controllerInnerType;
6
+ refs: refsType;
7
+ urls: urlsType;
8
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { CharacterInnerRef } from "../../inner/character";
14
+ export function CharacterRef(_a) {
15
+ var children = _a.children, props = _a.props, refs = _a.refs, urls = _a.urls;
16
+ return (_jsx(CharacterInnerRef, __assign({ url: urls.characterUrl, isActive: true, componentType: "character", rigidbodyType: "dynamic", controllerOptions: props.controllerOptions, groundRay: props.groundRay, onAnimate: props.onAnimate, onFrame: props.onFrame, onReady: props.onReady, onDestory: props.onDestory, rigidBodyProps: props.rigidBodyProps, parts: props.parts }, refs, { children: children })));
17
+ }
@@ -0,0 +1,12 @@
1
+ import { RigidBodyTypeString } from "@react-three/rapier";
2
+ import * as THREE from "three";
3
+ import { controllerOptionsType } from "../../../controller/type";
4
+ export type activeCharacterPropsType = {
5
+ characterUrl: string;
6
+ position?: THREE.Vector3;
7
+ rotation?: THREE.Euler;
8
+ controllerOptions?: controllerOptionsType;
9
+ currentAnimation?: string;
10
+ children?: React.ReactNode;
11
+ rigidbodyType?: RigidBodyTypeString;
12
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { activeVehicleInnerType } from "./type";
2
+ export declare function VehicleRef(props: activeVehicleInnerType): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { VehicleInnerRef } from "../../inner/vehicle";
14
+ export function VehicleRef(props) {
15
+ return (_jsx(VehicleInnerRef, __assign({ name: "vehicle", isActive: true, currentAnimation: "idle", componentType: "vehicle", ridingUrl: props.ridingUrl }, props, { children: props.children })));
16
+ }
@@ -0,0 +1,3 @@
1
+ import { innerRefType } from "../../passive/type";
2
+ import { passiveVehiclePropsType } from "../../passive/vehicle/type";
3
+ export type activeVehicleInnerType = passiveVehiclePropsType & innerRefType;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { controllerInnerType, refsType } from "../controller/type";
2
+ export declare function GaesupComponent({ props, refs, }: {
3
+ props: controllerInnerType;
4
+ refs: refsType;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,28 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { vec3 } from "@react-three/rapier";
14
+ import { useContext } from "react";
15
+ import { GaesupWorldContext } from "../world/context";
16
+ import { AirplaneRef } from "./active/airplane";
17
+ import { CharacterRef } from "./active/character";
18
+ import { VehicleRef } from "./active/vehicle";
19
+ export function GaesupComponent(_a) {
20
+ var props = _a.props, refs = _a.refs;
21
+ var _b = useContext(GaesupWorldContext), mode = _b.mode, states = _b.states, rideable = _b.rideable, urls = _b.urls;
22
+ var enableRiding = states.enableRiding, isRiderOn = states.isRiderOn, rideableId = states.rideableId;
23
+ return (_jsxs(_Fragment, { children: [mode.type === "character" && (_jsx(CharacterRef, { props: props, refs: refs, urls: urls, children: props.children })), mode.type === "vehicle" && (_jsx(VehicleRef, __assign({ controllerOptions: props.controllerOptions, url: urls.vehicleUrl, wheelUrl: urls.wheelUrl, ridingUrl: urls.ridingUrl, enableRiding: enableRiding, isRiderOn: isRiderOn, groundRay: props.groundRay, offset: rideableId && rideable[rideableId]
24
+ ? rideable[rideableId].offset
25
+ : vec3() }, refs, { children: props.children }))), mode.type === "airplane" && (_jsx(AirplaneRef, __assign({ controllerOptions: props.controllerOptions, url: urls.airplaneUrl, ridingUrl: urls.ridingUrl, enableRiding: enableRiding, isRiderOn: isRiderOn, groundRay: props.groundRay, offset: rideableId && rideable[rideableId]
26
+ ? rideable[rideableId].offset
27
+ : vec3() }, refs, { children: props.children })))] }));
28
+ }
@@ -0,0 +1,2 @@
1
+ import { airplaneInnerType } from "./type";
2
+ export declare function AirplaneInnerRef(props: airplaneInnerType): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { OuterGroupRef } from "../common/OuterGroupRef";
14
+ import { RigidBodyRef } from "../common/RigidbodyRef";
15
+ export function AirplaneInnerRef(props) {
16
+ var rigidBodyRef = props.rigidBodyRef, outerGroupRef = props.outerGroupRef;
17
+ return (_jsx(OuterGroupRef, { ref: outerGroupRef, children: _jsx(RigidBodyRef, __assign({ ref: rigidBodyRef, name: props.name, componentType: "airplane", ridingUrl: props.ridingUrl }, props, { children: props.children })) }));
18
+ }
@@ -0,0 +1,5 @@
1
+ import { ridingType, rigidBodyRefType } from "../common/type";
2
+ export type airplaneUrlType = {
3
+ wheelUrl?: string;
4
+ };
5
+ export type airplaneInnerType = rigidBodyRefType & ridingType & airplaneUrlType;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { characterInnerType } from "./type";
2
+ export declare function CharacterInnerRef(props: characterInnerType): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { OuterGroupRef } from "../common/OuterGroupRef";
14
+ import { RigidBodyRef } from "../common/RigidbodyRef";
15
+ export function CharacterInnerRef(props) {
16
+ var outerGroupRef = props.outerGroupRef;
17
+ return (_jsx(OuterGroupRef, { ref: outerGroupRef, children: _jsx(RigidBodyRef, __assign({ name: "character", url: props.url, controllerOptions: props.controllerOptions, ref: props.rigidBodyRef, groundRay: props.groundRay }, props, { children: props.children })) }));
18
+ }
@@ -0,0 +1,10 @@
1
+ import { callbackType } from "../../../controller/initialize/callback/type";
2
+ import { groundRayType, partsType } from "../../../controller/type";
3
+ import { passiveCharacterPropsType } from "../../passive/character/type";
4
+ import { componentTypeString, innerRefType } from "../../passive/type";
5
+ export type characterInnerType = {
6
+ componentType: componentTypeString;
7
+ isActive?: boolean;
8
+ groundRay: groundRayType;
9
+ parts?: partsType;
10
+ } & passiveCharacterPropsType & innerRefType & callbackType;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import * as THREE from "three";
2
+ export declare const InnerGroupRef: import("react").ForwardRefExoticComponent<{
3
+ children?: React.ReactNode;
4
+ objectNode: THREE.Object3D;
5
+ animationRef: import("react").MutableRefObject<THREE.Object3D<THREE.Object3DEventMap>>;
6
+ nodes: {
7
+ [name: string]: THREE.Object3D<THREE.Object3DEventMap>;
8
+ };
9
+ isActive?: boolean;
10
+ ridingUrl?: string;
11
+ offset?: THREE.Vector3;
12
+ parts?: import("../../../controller/type").partsType;
13
+ } & import("./type").ridingType & import("react").RefAttributes<THREE.Group<THREE.Object3DEventMap>>>;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import * as THREE from "three";
4
+ import RiderRef from "../rider";
5
+ export var InnerGroupRef = forwardRef(function (props, ref) {
6
+ return (_jsxs("group", { receiveShadow: true, castShadow: true, ref: ref, userData: { intangible: true }, children: [props.isRiderOn &&
7
+ props.enableRiding &&
8
+ props.isActive &&
9
+ props.ridingUrl && (_jsx(RiderRef, { url: props.ridingUrl, offset: props.offset })), props.children, props.objectNode && props.animationRef && (_jsx("primitive", { object: props.objectNode, visible: false, receiveShadow: true, castShadow: true, ref: props.animationRef })), Object.keys(props.nodes).map(function (name, key) {
10
+ var node = props.nodes[name];
11
+ if (node instanceof THREE.SkinnedMesh) {
12
+ return (_jsx("skinnedMesh", { castShadow: true, receiveShadow: true, material: node.material, geometry: node.geometry, skeleton: node.skeleton }, key));
13
+ }
14
+ else if (node instanceof THREE.Mesh) {
15
+ return (_jsx("mesh", { castShadow: true, receiveShadow: true, material: node.material, geometry: node.geometry }, key));
16
+ }
17
+ })] }));
18
+ });
@@ -0,0 +1,5 @@
1
+ import { ReactNode } from "react";
2
+ import * as THREE from "three";
3
+ export declare const OuterGroupRef: import("react").ForwardRefExoticComponent<{
4
+ children: ReactNode;
5
+ } & import("react").RefAttributes<THREE.Group<THREE.Object3DEventMap>>>;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ export var OuterGroupRef = forwardRef(function (_a, ref) {
4
+ var children = _a.children;
5
+ return (_jsx("group", { ref: ref, userData: { intangible: true }, children: children }));
6
+ });
@@ -0,0 +1,36 @@
1
+ import { RapierRigidBody } from "@react-three/rapier";
2
+ import * as THREE from "three";
3
+ export declare const RigidBodyRef: import("react").ForwardRefExoticComponent<{
4
+ name?: string;
5
+ userData?: {
6
+ intangible: boolean;
7
+ };
8
+ isActive?: boolean;
9
+ ridingUrl?: string;
10
+ groundRay?: import("../../../controller/type").groundRayType;
11
+ rigidBodyProps?: import("@react-three/rapier").RigidBodyProps;
12
+ parts?: import("../../../controller/type").partsType;
13
+ } & {
14
+ children?: React.ReactNode;
15
+ groundRay?: import("../../../controller/type").groundRayType;
16
+ url: string;
17
+ ridingUrl?: string;
18
+ wheelUrl?: string;
19
+ position?: THREE.Vector3;
20
+ rotation?: THREE.Euler;
21
+ offset?: THREE.Vector3;
22
+ controllerOptions?: import("../../../controller/type").controllerOptionsType;
23
+ currentAnimation?: string;
24
+ rigidbodyType?: import("@react-three/rapier").RigidBodyTypeString;
25
+ sensor?: boolean;
26
+ onIntersectionEnter?: (e: import("@react-three/rapier").CollisionEnterPayload) => Promise<void>;
27
+ onCollisionEnter?: (e: import("@react-three/rapier").CollisionEnterPayload) => Promise<void>;
28
+ componentType: import("../../passive/type").componentTypeString;
29
+ userData?: {
30
+ intangible: boolean;
31
+ };
32
+ rigidBodyProps?: import("@react-three/rapier").RigidBodyProps;
33
+ outerGroupProps?: THREE.Group;
34
+ innerGroupProps?: THREE.Group;
35
+ parts?: import("../../../controller/type").partsType;
36
+ } & import("./type").ridingType & import("../../passive/type").innerRefType & import("../../../controller/initialize/callback/type").callbackType & import("react").RefAttributes<RapierRigidBody>>;