gaesup-world 0.2.21 → 0.2.23

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 (216) hide show
  1. package/package.json +5 -2
  2. package/dist/gaesup/animation/actions.d.ts +0 -44
  3. package/dist/gaesup/animation/actions.js +0 -103
  4. package/dist/gaesup/camera/control/normal.d.ts +0 -4
  5. package/dist/gaesup/camera/control/normal.js +0 -18
  6. package/dist/gaesup/camera/control/orbit.d.ts +0 -4
  7. package/dist/gaesup/camera/control/orbit.js +0 -22
  8. package/dist/gaesup/camera/detector/index.d.ts +0 -2
  9. package/dist/gaesup/camera/detector/index.js +0 -25
  10. package/dist/gaesup/camera/index.d.ts +0 -8
  11. package/dist/gaesup/camera/index.js +0 -139
  12. package/dist/gaesup/camera/type.d.ts +0 -13
  13. package/dist/gaesup/camera/type.js +0 -1
  14. package/dist/gaesup/component/active/airplane/index.d.ts +0 -11
  15. package/dist/gaesup/component/active/airplane/index.js +0 -6
  16. package/dist/gaesup/component/active/character/index.d.ts +0 -7
  17. package/dist/gaesup/component/active/character/index.js +0 -34
  18. package/dist/gaesup/component/active/vehicle/index.d.ts +0 -12
  19. package/dist/gaesup/component/active/vehicle/index.js +0 -31
  20. package/dist/gaesup/component/index.d.ts +0 -7
  21. package/dist/gaesup/component/index.js +0 -19
  22. package/dist/gaesup/component/inner/airplane/index.d.ts +0 -2
  23. package/dist/gaesup/component/inner/airplane/index.js +0 -16
  24. package/dist/gaesup/component/inner/character/index.d.ts +0 -25
  25. package/dist/gaesup/component/inner/character/index.js +0 -28
  26. package/dist/gaesup/component/inner/common/InnerGroupRef.d.ts +0 -10
  27. package/dist/gaesup/component/inner/common/InnerGroupRef.js +0 -29
  28. package/dist/gaesup/component/inner/common/OuterGroupRef.d.ts +0 -4
  29. package/dist/gaesup/component/inner/common/OuterGroupRef.js +0 -6
  30. package/dist/gaesup/component/inner/common/RigidbodyRef.d.ts +0 -12
  31. package/dist/gaesup/component/inner/common/RigidbodyRef.js +0 -7
  32. package/dist/gaesup/component/inner/common/setGroundRay.d.ts +0 -9
  33. package/dist/gaesup/component/inner/common/setGroundRay.js +0 -14
  34. package/dist/gaesup/component/inner/common/type.d.ts +0 -20
  35. package/dist/gaesup/component/inner/common/type.js +0 -1
  36. package/dist/gaesup/component/inner/rider/index.d.ts +0 -11
  37. package/dist/gaesup/component/inner/rider/index.js +0 -31
  38. package/dist/gaesup/component/inner/vehicle/collider.d.ts +0 -10
  39. package/dist/gaesup/component/inner/vehicle/collider.js +0 -19
  40. package/dist/gaesup/component/inner/vehicle/index.d.ts +0 -2
  41. package/dist/gaesup/component/inner/vehicle/index.js +0 -17
  42. package/dist/gaesup/component/inner/vehicle/wheels.d.ts +0 -7
  43. package/dist/gaesup/component/inner/vehicle/wheels.js +0 -64
  44. package/dist/gaesup/component/passive/airplane/index.d.ts +0 -13
  45. package/dist/gaesup/component/passive/airplane/index.js +0 -40
  46. package/dist/gaesup/component/passive/character/index.d.ts +0 -10
  47. package/dist/gaesup/component/passive/character/index.js +0 -46
  48. package/dist/gaesup/component/passive/type.d.ts +0 -20
  49. package/dist/gaesup/component/passive/type.js +0 -1
  50. package/dist/gaesup/component/passive/vehicle/index.d.ts +0 -13
  51. package/dist/gaesup/component/passive/vehicle/index.js +0 -17
  52. package/dist/gaesup/component/type.d.ts +0 -17
  53. package/dist/gaesup/component/type.js +0 -1
  54. package/dist/gaesup/controller/context/index.d.ts +0 -49
  55. package/dist/gaesup/controller/context/index.js +0 -59
  56. package/dist/gaesup/controller/context/reducer.d.ts +0 -12
  57. package/dist/gaesup/controller/context/reducer.js +0 -21
  58. package/dist/gaesup/controller/context/type.d.ts +0 -38
  59. package/dist/gaesup/controller/context/type.js +0 -1
  60. package/dist/gaesup/controller/debug/airplane.d.ts +0 -71
  61. package/dist/gaesup/controller/debug/airplane.js +0 -71
  62. package/dist/gaesup/controller/debug/character.d.ts +0 -27
  63. package/dist/gaesup/controller/debug/character.js +0 -27
  64. package/dist/gaesup/controller/debug/index.d.ts +0 -6
  65. package/dist/gaesup/controller/debug/index.js +0 -49
  66. package/dist/gaesup/controller/debug/vehicle.d.ts +0 -27
  67. package/dist/gaesup/controller/debug/vehicle.js +0 -27
  68. package/dist/gaesup/controller/index.d.ts +0 -3
  69. package/dist/gaesup/controller/index.js +0 -74
  70. package/dist/gaesup/controller/initialize/callback/index.d.ts +0 -2
  71. package/dist/gaesup/controller/initialize/callback/index.js +0 -62
  72. package/dist/gaesup/controller/initialize/callback/type.d.ts +0 -27
  73. package/dist/gaesup/controller/initialize/callback/type.js +0 -1
  74. package/dist/gaesup/controller/initialize/index.d.ts +0 -10
  75. package/dist/gaesup/controller/initialize/index.js +0 -75
  76. package/dist/gaesup/controller/type.d.ts +0 -85
  77. package/dist/gaesup/controller/type.js +0 -1
  78. package/dist/gaesup/gaesupProps/index.d.ts +0 -7
  79. package/dist/gaesup/gaesupProps/index.js +0 -46
  80. package/dist/gaesup/hooks/useGaesupAnimation/index.d.ts +0 -10
  81. package/dist/gaesup/hooks/useGaesupAnimation/index.js +0 -95
  82. package/dist/gaesup/hooks/useGaesupController/index.d.ts +0 -10
  83. package/dist/gaesup/hooks/useGaesupController/index.js +0 -14
  84. package/dist/gaesup/hooks/useGaesupGltf/index.d.ts +0 -25
  85. package/dist/gaesup/hooks/useGaesupGltf/index.js +0 -73
  86. package/dist/gaesup/hooks/useJoyStick/index.d.ts +0 -39
  87. package/dist/gaesup/hooks/useJoyStick/index.js +0 -61
  88. package/dist/gaesup/hooks/usePushKey/index.d.ts +0 -3
  89. package/dist/gaesup/hooks/usePushKey/index.js +0 -29
  90. package/dist/gaesup/hooks/useRideable/index.d.ts +0 -28
  91. package/dist/gaesup/hooks/useRideable/index.js +0 -199
  92. package/dist/gaesup/hooks/useTeleport/index.d.ts +0 -3
  93. package/dist/gaesup/hooks/useTeleport/index.js +0 -12
  94. package/dist/gaesup/physics/airplane/damping.d.ts +0 -2
  95. package/dist/gaesup/physics/airplane/damping.js +0 -5
  96. package/dist/gaesup/physics/airplane/direction.d.ts +0 -2
  97. package/dist/gaesup/physics/airplane/direction.js +0 -65
  98. package/dist/gaesup/physics/airplane/gravity.d.ts +0 -14
  99. package/dist/gaesup/physics/airplane/gravity.js +0 -18
  100. package/dist/gaesup/physics/airplane/impulse.d.ts +0 -16
  101. package/dist/gaesup/physics/airplane/impulse.js +0 -31
  102. package/dist/gaesup/physics/airplane/index.d.ts +0 -2
  103. package/dist/gaesup/physics/airplane/index.js +0 -14
  104. package/dist/gaesup/physics/airplane/innerCalc.d.ts +0 -2
  105. package/dist/gaesup/physics/airplane/innerCalc.js +0 -27
  106. package/dist/gaesup/physics/airplane/landing.d.ts +0 -2
  107. package/dist/gaesup/physics/airplane/landing.js +0 -29
  108. package/dist/gaesup/physics/character/direction.d.ts +0 -23
  109. package/dist/gaesup/physics/character/direction.js +0 -55
  110. package/dist/gaesup/physics/character/impulse.d.ts +0 -2
  111. package/dist/gaesup/physics/character/impulse.js +0 -43
  112. package/dist/gaesup/physics/character/index.d.ts +0 -2
  113. package/dist/gaesup/physics/character/index.js +0 -8
  114. package/dist/gaesup/physics/character/innerCalc.d.ts +0 -2
  115. package/dist/gaesup/physics/character/innerCalc.js +0 -31
  116. package/dist/gaesup/physics/check/ground.d.ts +0 -2
  117. package/dist/gaesup/physics/check/ground.js +0 -15
  118. package/dist/gaesup/physics/check/index.d.ts +0 -2
  119. package/dist/gaesup/physics/check/index.js +0 -12
  120. package/dist/gaesup/physics/check/moving.d.ts +0 -2
  121. package/dist/gaesup/physics/check/moving.js +0 -16
  122. package/dist/gaesup/physics/check/push.d.ts +0 -2
  123. package/dist/gaesup/physics/check/push.js +0 -6
  124. package/dist/gaesup/physics/check/riding.d.ts +0 -2
  125. package/dist/gaesup/physics/check/riding.js +0 -7
  126. package/dist/gaesup/physics/check/rotate.d.ts +0 -2
  127. package/dist/gaesup/physics/check/rotate.js +0 -8
  128. package/dist/gaesup/physics/index.d.ts +0 -2
  129. package/dist/gaesup/physics/index.js +0 -58
  130. package/dist/gaesup/physics/type.d.ts +0 -36
  131. package/dist/gaesup/physics/type.js +0 -1
  132. package/dist/gaesup/physics/vehicle/damping.d.ts +0 -2
  133. package/dist/gaesup/physics/vehicle/damping.js +0 -6
  134. package/dist/gaesup/physics/vehicle/direction.d.ts +0 -4
  135. package/dist/gaesup/physics/vehicle/direction.js +0 -30
  136. package/dist/gaesup/physics/vehicle/impulse.d.ts +0 -16
  137. package/dist/gaesup/physics/vehicle/impulse.js +0 -40
  138. package/dist/gaesup/physics/vehicle/index.d.ts +0 -2
  139. package/dist/gaesup/physics/vehicle/index.js +0 -12
  140. package/dist/gaesup/physics/vehicle/innerCalc.d.ts +0 -2
  141. package/dist/gaesup/physics/vehicle/innerCalc.js +0 -24
  142. package/dist/gaesup/physics/vehicle/landing.d.ts +0 -2
  143. package/dist/gaesup/physics/vehicle/landing.js +0 -29
  144. package/dist/gaesup/tools/gameBoy/GameBoyButton.d.ts +0 -9
  145. package/dist/gaesup/tools/gameBoy/GameBoyButton.js +0 -16
  146. package/dist/gaesup/tools/gameBoy/index.d.ts +0 -8
  147. package/dist/gaesup/tools/gameBoy/index.js +0 -22
  148. package/dist/gaesup/tools/gameBoy/type.d.ts +0 -4
  149. package/dist/gaesup/tools/gameBoy/type.js +0 -1
  150. package/dist/gaesup/tools/gamePad/GamePadButton.d.ts +0 -8
  151. package/dist/gaesup/tools/gamePad/GamePadButton.js +0 -21
  152. package/dist/gaesup/tools/gamePad/index.d.ts +0 -6
  153. package/dist/gaesup/tools/gamePad/index.js +0 -32
  154. package/dist/gaesup/tools/gamePad/type.d.ts +0 -6
  155. package/dist/gaesup/tools/gamePad/type.js +0 -1
  156. package/dist/gaesup/tools/joyStick/index.d.ts +0 -6
  157. package/dist/gaesup/tools/joyStick/index.js +0 -169
  158. package/dist/gaesup/tools/joyStick/type.d.ts +0 -19
  159. package/dist/gaesup/tools/joyStick/type.js +0 -1
  160. package/dist/gaesup/tools/jumpPortal/index.d.ts +0 -16
  161. package/dist/gaesup/tools/jumpPortal/index.js +0 -18
  162. package/dist/gaesup/tools/keyBoardToolTip/constant.d.ts +0 -402
  163. package/dist/gaesup/tools/keyBoardToolTip/constant.js +0 -122
  164. package/dist/gaesup/tools/keyBoardToolTip/default.d.ts +0 -10
  165. package/dist/gaesup/tools/keyBoardToolTip/default.js +0 -12
  166. package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +0 -3
  167. package/dist/gaesup/tools/keyBoardToolTip/index.js +0 -70
  168. package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +0 -37
  169. package/dist/gaesup/tools/keyBoardToolTip/type.js +0 -1
  170. package/dist/gaesup/tools/miniMap/default.d.ts +0 -9
  171. package/dist/gaesup/tools/miniMap/default.js +0 -9
  172. package/dist/gaesup/tools/miniMap/index.d.ts +0 -3
  173. package/dist/gaesup/tools/miniMap/index.js +0 -72
  174. package/dist/gaesup/tools/miniMap/type.d.ts +0 -25
  175. package/dist/gaesup/tools/miniMap/type.js +0 -1
  176. package/dist/gaesup/tools/rideable/index.d.ts +0 -3
  177. package/dist/gaesup/tools/rideable/index.js +0 -79
  178. package/dist/gaesup/tools/type.d.ts +0 -2
  179. package/dist/gaesup/tools/type.js +0 -1
  180. package/dist/gaesup/tools/zoomButton/index.d.ts +0 -18
  181. package/dist/gaesup/tools/zoomButton/index.js +0 -146
  182. package/dist/gaesup/utils/context.d.ts +0 -2
  183. package/dist/gaesup/utils/context.js +0 -3
  184. package/dist/gaesup/utils/debug.d.ts +0 -29
  185. package/dist/gaesup/utils/debug.js +0 -36
  186. package/dist/gaesup/utils/index.d.ts +0 -3
  187. package/dist/gaesup/utils/index.js +0 -3
  188. package/dist/gaesup/utils/ray.d.ts +0 -7
  189. package/dist/gaesup/utils/ray.js +0 -6
  190. package/dist/gaesup/utils/ref.d.ts +0 -2
  191. package/dist/gaesup/utils/ref.js +0 -16
  192. package/dist/gaesup/utils/type.d.ts +0 -5
  193. package/dist/gaesup/utils/type.js +0 -1
  194. package/dist/gaesup/utils/vector.d.ts +0 -10
  195. package/dist/gaesup/utils/vector.js +0 -33
  196. package/dist/gaesup/world/context/index.d.ts +0 -6
  197. package/dist/gaesup/world/context/index.js +0 -117
  198. package/dist/gaesup/world/context/reducer.d.ts +0 -29
  199. package/dist/gaesup/world/context/reducer.js +0 -21
  200. package/dist/gaesup/world/context/type.d.ts +0 -169
  201. package/dist/gaesup/world/context/type.js +0 -1
  202. package/dist/gaesup/world/debug/cameraOption.d.ts +0 -47
  203. package/dist/gaesup/world/debug/cameraOption.js +0 -47
  204. package/dist/gaesup/world/debug/index.d.ts +0 -6
  205. package/dist/gaesup/world/debug/index.js +0 -32
  206. package/dist/gaesup/world/debug/mode.d.ts +0 -10
  207. package/dist/gaesup/world/debug/mode.js +0 -10
  208. package/dist/gaesup/world/index.d.ts +0 -3
  209. package/dist/gaesup/world/index.js +0 -9
  210. package/dist/gaesup/world/initalize/index.d.ts +0 -35
  211. package/dist/gaesup/world/initalize/index.js +0 -62
  212. package/dist/gaesup/world/type.d.ts +0 -19
  213. package/dist/gaesup/world/type.js +0 -1
  214. package/dist/index.d.ts +0 -23
  215. package/index.ts +0 -29
  216. package/yarn-error.log +0 -12152
@@ -1,85 +0,0 @@
1
- import { Collider, Ray, RayColliderToi } from "@dimforge/rapier3d-compat";
2
- import { GroupProps } from "@react-three/fiber";
3
- import { RapierRigidBody, RigidBodyProps } from "@react-three/rapier";
4
- import { ReactNode, RefObject } from "react";
5
- import * as THREE from "three";
6
- import { cameraRayType } from "../camera/type";
7
- import { keyControlType, urlsType } from "../world/context/type";
8
- import { airplaneType, characterType, vehicleType } from "./context/type";
9
- import { callbackType } from "./initialize/callback/type";
10
- export type optionsType = {
11
- debug: boolean;
12
- mode?: "normal" | "vehicle" | "airplane";
13
- controllerType: "none" | "gameboy" | "joystick" | "keyboard";
14
- cameraCollisionType: "transparent" | "closeUp";
15
- camera: {
16
- type: "perspective" | "orthographic";
17
- control: "orbit" | "normal";
18
- };
19
- minimap: boolean;
20
- minimapRatio: number;
21
- };
22
- export type partialOptionsType = Partial<optionsType>;
23
- export type jumpInnerType = {
24
- velocity: THREE.Vector3;
25
- direction: THREE.Vector3;
26
- };
27
- export type jumpConstType = {
28
- speed: number;
29
- gravity: number;
30
- };
31
- export type jumpPropType = jumpInnerType & jumpConstType;
32
- export type rayType = {
33
- origin: THREE.Vector3;
34
- hit: RayColliderToi | null;
35
- rayCast: Ray | null;
36
- dir: THREE.Vector3;
37
- offset: THREE.Vector3;
38
- length: number;
39
- current?: THREE.Vector3;
40
- angle?: number;
41
- parent?: RapierRigidBody | null | undefined;
42
- };
43
- export type slopeRayType = Omit<rayType, "parent">;
44
- export type groundRayType = Omit<rayType, "current" | "angle">;
45
- export type controllerInnerType = {
46
- name?: string;
47
- groundRay: groundRayType;
48
- cameraRay: cameraRayType;
49
- keyControl: keyControlType;
50
- } & controllerOtherPropType & refsType & callbackType;
51
- export type animationTagType = {
52
- idle: string;
53
- walk: string;
54
- run: string;
55
- jump: string;
56
- jumpIdle: string;
57
- jumpLand: string;
58
- fall: string;
59
- ride: string;
60
- land: string;
61
- sit: string;
62
- };
63
- export type actionsType = animationTagType & {
64
- [key: string]: string;
65
- };
66
- export type refsType = {
67
- colliderRef: RefObject<Collider>;
68
- rigidBodyRef: RefObject<RapierRigidBody>;
69
- outerGroupRef: RefObject<THREE.Group>;
70
- innerGroupRef: RefObject<THREE.Group>;
71
- characterInnerRef: RefObject<THREE.Group>;
72
- };
73
- export type gaesupControllerContextPropType = {
74
- airplane: airplaneType;
75
- vehicle: vehicleType;
76
- character: characterType;
77
- urls: urlsType;
78
- };
79
- export interface controllerOtherPropType extends RigidBodyProps {
80
- children?: ReactNode;
81
- groupProps?: GroupProps;
82
- rigidBodyProps?: RigidBodyProps;
83
- debug?: boolean;
84
- }
85
- export type controllerType = controllerOtherPropType & Partial<gaesupControllerContextPropType> & callbackType;
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function GaeSupProps({ type, text, position, children, }: {
3
- type?: "normal" | "ground";
4
- text?: string;
5
- position?: [number, number, number];
6
- children: React.ReactNode;
7
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,46 +0,0 @@
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 { vec3 } from "@react-three/rapier";
14
- import { Suspense, useContext, useEffect, useMemo, useRef } from "react";
15
- import * as THREE from "three";
16
- import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/context/index.js";
17
- export function GaeSupProps(_a) {
18
- var _b = _a.type, type = _b === void 0 ? "normal" : _b, text = _a.text, position = _a.position, children = _a.children;
19
- var groupRef = useRef(null);
20
- var minimap = useContext(GaesupWorldContext).minimap;
21
- var dispatch = useContext(GaesupWorldDispatchContext);
22
- var groupComponent = useMemo(function () {
23
- return (_jsx("group", { ref: groupRef, position: position, children: children }));
24
- }, []);
25
- useEffect(function () {
26
- if (groupRef.current) {
27
- var box = new THREE.Box3().setFromObject(groupRef.current);
28
- var size = vec3(box.getSize(new THREE.Vector3())).clone();
29
- var center = vec3(box.getCenter(new THREE.Vector3())).clone();
30
- var obj = {
31
- type: type ? type : "normal",
32
- text: text,
33
- size: size,
34
- center: center,
35
- };
36
- minimap.props[text] = obj;
37
- dispatch({
38
- type: "update",
39
- payload: {
40
- minimap: __assign({}, minimap),
41
- },
42
- });
43
- }
44
- }, []);
45
- return _jsx(Suspense, { fallback: null, children: groupComponent });
46
- }
@@ -1,10 +0,0 @@
1
- import { animationAtomType } from "../../world/context/type";
2
- export declare function useGaesupAnimation({ type, }: {
3
- type: "character" | "vehicle" | "airplane";
4
- }): {
5
- subscribe: ({ tag, condition, action, animationName, key, }: animationAtomType) => void;
6
- subscribeAll: (props: animationAtomType[]) => void;
7
- store: {};
8
- unsubscribe: (tag: string) => void;
9
- notify: () => string;
10
- };
@@ -1,95 +0,0 @@
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 { useContext } from "react";
13
- import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
14
- export function useGaesupAnimation(_a) {
15
- var type = _a.type;
16
- var animationState = useContext(GaesupWorldContext).animationState;
17
- var dispatch = useContext(GaesupWorldDispatchContext);
18
- var getAnimationTag = function (tag) {
19
- var animation = animationState[type].store[tag];
20
- if (!animation)
21
- return { name: animationState[type].default, isValid: false };
22
- if (animation.condition()) {
23
- return { name: animation.animationName, isValid: true };
24
- }
25
- else {
26
- return { name: animationState[type].default, isValid: false };
27
- }
28
- };
29
- var notify = function () {
30
- var tag = animationState[type].default;
31
- for (var _i = 0, _a = Object.keys(animationState[type].store); _i < _a.length; _i++) {
32
- var key = _a[_i];
33
- var checked = getAnimationTag(key);
34
- if (checked.isValid) {
35
- tag = checked.name;
36
- break;
37
- }
38
- }
39
- animationState[type].current = tag;
40
- dispatch({
41
- type: "update",
42
- payload: {
43
- animationState: __assign({}, animationState),
44
- },
45
- });
46
- return tag;
47
- };
48
- var unsubscribe = function (tag) {
49
- delete animationState[type].store[tag];
50
- dispatch({
51
- type: "update",
52
- payload: {
53
- animationState: __assign({}, animationState),
54
- },
55
- });
56
- };
57
- var subscribe = function (_a) {
58
- var tag = _a.tag, condition = _a.condition, action = _a.action, animationName = _a.animationName, key = _a.key;
59
- animationState[type].store[tag] = {
60
- condition: condition,
61
- action: action || (function () { }),
62
- animationName: animationName || tag,
63
- key: key || tag,
64
- };
65
- dispatch({
66
- type: "update",
67
- payload: {
68
- animationState: __assign({}, animationState),
69
- },
70
- });
71
- };
72
- var subscribeAll = function (props) {
73
- props.forEach(function (item) {
74
- animationState[type].store[item.tag] = {
75
- condition: item.condition,
76
- action: item.action,
77
- animationName: item.animationName,
78
- key: item.key,
79
- };
80
- });
81
- dispatch({
82
- type: "update",
83
- payload: {
84
- animationState: __assign({}, animationState),
85
- },
86
- });
87
- };
88
- return {
89
- subscribe: subscribe,
90
- subscribeAll: subscribeAll,
91
- store: animationState[type].store,
92
- unsubscribe: unsubscribe,
93
- notify: notify,
94
- };
95
- }
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { activeStateType, modeType, urlsType } from "../../world/context/type";
3
- export declare function useGaesupController(): gaesupPassivePropsType;
4
- export type gaesupPassivePropsType = {
5
- state: activeStateType;
6
- mode: modeType;
7
- urls: urlsType;
8
- currentAnimation: string;
9
- children?: React.ReactNode;
10
- };
@@ -1,14 +0,0 @@
1
- // "Please use this only as a subcomponent of GaesupWorld."
2
- import { useContext } from "react";
3
- import { GaesupWorldContext } from "../../world/context";
4
- export function useGaesupController() {
5
- var worldContext = useContext(GaesupWorldContext);
6
- return {
7
- state: worldContext.activeState,
8
- mode: worldContext.mode,
9
- urls: worldContext.urls,
10
- currentAnimation: worldContext.mode.type
11
- ? worldContext.animationState[worldContext.mode.type].current
12
- : "idle",
13
- };
14
- }
@@ -1,25 +0,0 @@
1
- import * as THREE from "three";
2
- import { GLTFResult } from "../../component/type";
3
- import { urlsType } from "../../world/context/type";
4
- export type gltfAndSizeType = {
5
- size: THREE.Vector3;
6
- setSize: (size: THREE.Vector3, keyName?: string) => void;
7
- getSize: () => THREE.Vector3;
8
- };
9
- export type useGltfAndSizeType = {
10
- url: string;
11
- };
12
- export declare const useGltfAndSize: ({ url }: useGltfAndSizeType) => {
13
- gltf: GLTFResult;
14
- size: THREE.Vector3;
15
- setSize: (size?: THREE.Vector3, keyName?: string) => THREE.Vector3;
16
- getSize: (keyName?: string) => THREE.Vector3;
17
- };
18
- export declare const useGaesupGltf: () => {
19
- getSizesByUrls: (urls?: urlsType) => {
20
- characterUrl?: THREE.Vector3;
21
- vehicleUrl?: THREE.Vector3;
22
- airplaneUrl?: THREE.Vector3;
23
- wheelUrl?: THREE.Vector3;
24
- };
25
- };
@@ -1,73 +0,0 @@
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 { useGLTF } from "@react-three/drei";
13
- import { useContext } from "react";
14
- import * as THREE from "three";
15
- import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
16
- export var useGltfAndSize = function (_a) {
17
- var url = _a.url;
18
- var sizes = useContext(GaesupWorldContext).sizes;
19
- var dispatch = useContext(GaesupWorldDispatchContext);
20
- var gltf = useGLTF(url);
21
- var scene = gltf.scene;
22
- var makeGltfSize = function () {
23
- return new THREE.Box3().setFromObject(scene).getSize(new THREE.Vector3());
24
- };
25
- // getter
26
- var getSize = function (keyName) {
27
- var key = keyName || url;
28
- if (key in sizes) {
29
- return sizes[key];
30
- }
31
- else {
32
- return null;
33
- }
34
- };
35
- // setter
36
- var setSize = function (size, keyName) {
37
- var key = keyName || url;
38
- if (!(key in sizes)) {
39
- sizes[key] = size || makeGltfSize();
40
- dispatch({
41
- type: "update",
42
- payload: {
43
- sizes: __assign({}, sizes),
44
- },
45
- });
46
- return sizes[key];
47
- }
48
- else {
49
- return sizes[key];
50
- }
51
- };
52
- return { gltf: gltf, size: setSize(), setSize: setSize, getSize: getSize };
53
- };
54
- export var useGaesupGltf = function () {
55
- var sizes = useContext(GaesupWorldContext).sizes;
56
- // get size by url
57
- var getSizesByUrls = function (urls) {
58
- var matchedSizes = {};
59
- if (!urls)
60
- return matchedSizes;
61
- Object.keys(urls).forEach(function (key) {
62
- var url = urls[key];
63
- if (url in sizes) {
64
- matchedSizes[key] = sizes[url];
65
- }
66
- else {
67
- matchedSizes[key] = null;
68
- }
69
- });
70
- return matchedSizes;
71
- };
72
- return { getSizesByUrls: getSizesByUrls };
73
- };
@@ -1,39 +0,0 @@
1
- import { joyStickBallType, joyStickOriginType } from "../../tools/joyStick/type";
2
- export declare const joyStickBallDefault: {
3
- top: string;
4
- left: string;
5
- };
6
- export declare const joyStickOriginDefault: {
7
- x: number;
8
- y: number;
9
- angle: number;
10
- currentRadius: number;
11
- originRadius: number;
12
- isIn: boolean;
13
- isOn: boolean;
14
- isUp: boolean;
15
- isCenter: boolean;
16
- };
17
- export declare const joyStickInnerDefault: {
18
- joyStickBall: {
19
- top: string;
20
- left: string;
21
- };
22
- joyStickOrigin: {
23
- x: number;
24
- y: number;
25
- angle: number;
26
- currentRadius: number;
27
- originRadius: number;
28
- isIn: boolean;
29
- isOn: boolean;
30
- isUp: boolean;
31
- isCenter: boolean;
32
- };
33
- };
34
- export default function useJoyStick(): {
35
- joyStickOrigin: joyStickOriginType;
36
- joyStickBall: joyStickBallType;
37
- setBall: (ball: joyStickBallType) => void;
38
- setOrigin: (origin: joyStickOriginType) => void;
39
- };
@@ -1,61 +0,0 @@
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 { useContext } from "react";
13
- import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
14
- export var joyStickBallDefault = {
15
- top: "50%",
16
- left: "50%",
17
- };
18
- export var joyStickOriginDefault = {
19
- x: 0,
20
- y: 0,
21
- angle: Math.PI / 2,
22
- currentRadius: 0,
23
- originRadius: 0,
24
- isIn: true,
25
- isOn: false,
26
- isUp: true,
27
- isCenter: true,
28
- };
29
- export var joyStickInnerDefault = {
30
- joyStickBall: joyStickBallDefault,
31
- joyStickOrigin: joyStickOriginDefault,
32
- };
33
- export default function useJoyStick() {
34
- var joystick = useContext(GaesupWorldContext).joystick;
35
- var dispatch = useContext(GaesupWorldDispatchContext);
36
- var joyStickBall = joystick.joyStickBall, joyStickOrigin = joystick.joyStickOrigin;
37
- var setBall = function (ball) {
38
- joystick.joyStickBall = Object.assign(joyStickBall, ball);
39
- dispatch({
40
- type: "update",
41
- payload: {
42
- joystick: __assign(__assign({}, joystick), { joyStickBall: __assign({}, joystick.joyStickBall) }),
43
- },
44
- });
45
- };
46
- var setOrigin = function (origin) {
47
- joystick.joyStickOrigin = Object.assign(joyStickOrigin, origin);
48
- dispatch({
49
- type: "update",
50
- payload: {
51
- joystick: __assign(__assign({}, joystick), { joyStickOrigin: __assign({}, joystick.joyStickOrigin) }),
52
- },
53
- });
54
- };
55
- return {
56
- joyStickOrigin: joyStickOrigin,
57
- joyStickBall: joyStickBall,
58
- setBall: setBall,
59
- setOrigin: setOrigin,
60
- };
61
- }
@@ -1,3 +0,0 @@
1
- export declare function usePushKey(): {
2
- pushKey: (key: string, value: boolean) => void;
3
- };
@@ -1,29 +0,0 @@
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 { useContext } from "react";
13
- import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
14
- export function usePushKey() {
15
- var control = useContext(GaesupWorldContext).control;
16
- var dispatch = useContext(GaesupWorldDispatchContext);
17
- var pushKey = function (key, value) {
18
- control[key] = value;
19
- dispatch({
20
- type: "update",
21
- payload: {
22
- control: __assign({}, control),
23
- },
24
- });
25
- };
26
- return {
27
- pushKey: pushKey,
28
- };
29
- }
@@ -1,28 +0,0 @@
1
- import { CollisionEnterPayload } from "@react-three/rapier";
2
- import { rideableType } from "../../world/context/type";
3
- /**
4
- * Default rideable object properties.
5
- * @type {Object}
6
- */
7
- export declare const rideableDefault: {
8
- objectkey: any;
9
- objectType: any;
10
- isRiderOn: boolean;
11
- url: any;
12
- wheelUrl: any;
13
- position: import("three").Vector3;
14
- rotation: import("three").Euler;
15
- offset: import("three").Vector3;
16
- visible: boolean;
17
- };
18
- /**
19
- * Custom hook for managing rideable objects.
20
- * @returns {Object} An object containing functions to initialize, set, get, ride, and land rideable objects.
21
- */
22
- export declare function useRideable(): {
23
- initRideable: (props: rideableType) => void;
24
- setRideable: (props: rideableType) => void;
25
- getRideable: (objectkey: string) => rideableType;
26
- ride: (e: CollisionEnterPayload, props: rideableType) => Promise<void>;
27
- landing: (objectkey: string) => void;
28
- };