gaesup-world 0.0.72 → 0.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gaesup/animation/actions.js +14 -12
- package/dist/gaesup/camera/control/normal.js +1 -1
- package/dist/gaesup/camera/index.js +4 -5
- package/dist/gaesup/controller/context/reducer.d.ts +2 -2
- package/dist/gaesup/controller/context/type.d.ts +3 -3
- package/dist/gaesup/controller/initialize/index.js +2 -2
- package/dist/gaesup/tools/minimap/index.js +5 -3
- package/dist/gaesup/tools/minimap/type.d.ts +2 -0
- package/dist/gaesup/tools/pushKey/index.js +1 -1
- package/dist/gaesup/world/context/index.js +1 -0
- package/dist/gaesup/world/context/reducer.d.ts +1 -0
- package/dist/gaesup/world/context/type.d.ts +1 -0
- package/dist/gaesup/world/initalize/index.d.ts +1 -0
- package/dist/gaesup/world/initalize/index.js +1 -0
- package/dist/gaesup/world/type.d.ts +1 -0
- package/package.json +1 -1
|
@@ -56,7 +56,7 @@ export function usePlayActions() {
|
|
|
56
56
|
export default function playCharacterActions(_a) {
|
|
57
57
|
var groundRay = _a.groundRay;
|
|
58
58
|
var _b = usePlayActions(), _c = _b.resultRef.character, actions = _c.actions, ref = _c.ref, play = _b.play, setAnimationName = _b.setAnimationName;
|
|
59
|
-
var _d = useContext(GaesupWorldContext), states = _d.states, activeState = _d.activeState, animations = _d.animations, mode = _d.mode;
|
|
59
|
+
var _d = useContext(GaesupWorldContext), states = _d.states, activeState = _d.activeState, animations = _d.animations, mode = _d.mode, freeze = _d.freeze;
|
|
60
60
|
var isNotMoving = states.isNotMoving, isMoving = states.isMoving, isJumping = states.isJumping, isRunning = states.isRunning, isAnimationOuter = states.isAnimationOuter, isOnTheGround = states.isOnTheGround;
|
|
61
61
|
var dispatch = useContext(GaesupWorldDispatchContext);
|
|
62
62
|
var control = useKeyboardControls()[1]();
|
|
@@ -74,14 +74,16 @@ export default function playCharacterActions(_a) {
|
|
|
74
74
|
};
|
|
75
75
|
}, []);
|
|
76
76
|
useEffect(function () {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
if (!freeze) {
|
|
78
|
+
animations.keyControl = control;
|
|
79
|
+
dispatch({
|
|
80
|
+
type: "update",
|
|
81
|
+
payload: {
|
|
82
|
+
animations: __assign({}, animations),
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, [control, freeze]);
|
|
85
87
|
useEffect(function () {
|
|
86
88
|
var _a;
|
|
87
89
|
if (mode.type === "character") {
|
|
@@ -116,9 +118,9 @@ export default function playCharacterActions(_a) {
|
|
|
116
118
|
// }
|
|
117
119
|
// }
|
|
118
120
|
// }
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
if (groundRay.hit === null && activeState.velocity.y < 0) {
|
|
122
|
+
playFall();
|
|
123
|
+
}
|
|
122
124
|
}
|
|
123
125
|
}
|
|
124
126
|
});
|
|
@@ -4,6 +4,6 @@ export default function normal(prop) {
|
|
|
4
4
|
var cameraPosition = activeState.position
|
|
5
5
|
.clone()
|
|
6
6
|
.add(V3(0, perspectiveCamera.YDistance, perspectiveCamera.XZDistance));
|
|
7
|
-
state.camera.position.lerp(cameraPosition,
|
|
7
|
+
state.camera.position.lerp(cameraPosition, 0.9);
|
|
8
8
|
state.camera.lookAt(activeState.position.clone());
|
|
9
9
|
}
|
|
@@ -19,7 +19,6 @@ import { GaesupWorldContext } from "../world/context";
|
|
|
19
19
|
import mapControl from "./control/map";
|
|
20
20
|
import normal from "./control/normal";
|
|
21
21
|
import orbit from "./control/orbit";
|
|
22
|
-
import detector from "./detector";
|
|
23
22
|
export default function Camera(_a) {
|
|
24
23
|
var refs = _a.refs, prop = _a.prop, control = _a.control;
|
|
25
24
|
var worldContext = useContext(GaesupWorldContext);
|
|
@@ -64,10 +63,10 @@ export default function Camera(_a) {
|
|
|
64
63
|
else if (cameraMode.cameraType === "orthographic") {
|
|
65
64
|
mapControl(cameraProp);
|
|
66
65
|
}
|
|
67
|
-
|
|
68
|
-
cameraRay.origin.copy(camera.position);
|
|
69
|
-
cameraRay.dir.copy(distV3.negate().normalize());
|
|
70
|
-
detector(cameraProp);
|
|
66
|
+
// const distV3 = camera.position.clone().sub(activeState.position);
|
|
67
|
+
// cameraRay.origin.copy(camera.position);
|
|
68
|
+
// cameraRay.dir.copy(distV3.negate().normalize());
|
|
69
|
+
// detector(cameraProp);
|
|
71
70
|
});
|
|
72
71
|
return (_jsxs(_Fragment, { children: [cameraMode.cameraType === "perspective" && (_jsxs(_Fragment, { children: [_jsx(OrbitControls, { target: activeState.position }), _jsx(PerspectiveCamera, __assign({ makeDefault: true }, perspectiveCamera))] })), cameraMode.cameraType === "orthographic" && (_jsxs(_Fragment, { children: [_jsx(MapControls, { target: activeState.position }), _jsx(OrthographicCamera, __assign({ makeDefault: true }, orthographicCamera))] }))] }));
|
|
73
72
|
}
|
|
@@ -11,6 +11,6 @@ export declare function gaesupControllerReducer(props: gaesupControllerType, act
|
|
|
11
11
|
vehicle: import("./type").vehicleType;
|
|
12
12
|
character: import("./type").characterType;
|
|
13
13
|
isRider: boolean;
|
|
14
|
-
callbacks
|
|
15
|
-
refs
|
|
14
|
+
callbacks?: import("../initialize/callback/type").callbackType;
|
|
15
|
+
refs?: import("../type").refsType;
|
|
16
16
|
};
|
|
@@ -62,10 +62,10 @@ export type orthographicCameraDebugType = {
|
|
|
62
62
|
far?: number;
|
|
63
63
|
};
|
|
64
64
|
export type perspectiveCameraPropType = {
|
|
65
|
-
isFront
|
|
65
|
+
isFront?: boolean;
|
|
66
66
|
} & perspectiveCameraDebugType;
|
|
67
67
|
export type gaesupControllerType = gaesupControllerContextPropType & {
|
|
68
|
-
callbacks
|
|
69
|
-
refs
|
|
68
|
+
callbacks?: callbackType;
|
|
69
|
+
refs?: refsType;
|
|
70
70
|
};
|
|
71
71
|
export type gaesupDisptachType = dispatchType<gaesupControllerType>;
|
|
@@ -22,7 +22,7 @@ export default function initControllerProps(_a) {
|
|
|
22
22
|
var _b = useKeyboardControls(), _ = _b[0], getKeys = _b[1];
|
|
23
23
|
var keyControl = getKeys();
|
|
24
24
|
useEffect(function () {
|
|
25
|
-
if (context && keyControl && context.control) {
|
|
25
|
+
if (context && keyControl && context.control && !context.freeze) {
|
|
26
26
|
dispatch({
|
|
27
27
|
type: "update",
|
|
28
28
|
payload: {
|
|
@@ -32,7 +32,7 @@ export default function initControllerProps(_a) {
|
|
|
32
32
|
},
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
}, [context.mode.controller, keyControl, context.control]);
|
|
35
|
+
}, [context.mode.controller, keyControl, context.control, context.freeze]);
|
|
36
36
|
var groundRay = useMemo(function () {
|
|
37
37
|
return {
|
|
38
38
|
origin: vec3(),
|
|
@@ -36,7 +36,9 @@ export function MiniMap(props) {
|
|
|
36
36
|
upscale();
|
|
37
37
|
else
|
|
38
38
|
downscale();
|
|
39
|
-
}, style: assignInlineVars(minimapStyle), children: [_jsx("div", { className: style.minimapOuter, style: assignInlineVars(objectStyle) }), _jsxs("div", { className: style.minimapInner, style: assignInlineVars(__assign({ transform:
|
|
39
|
+
}, style: assignInlineVars(minimapStyle), children: [_jsx("div", { className: style.minimapOuter, style: assignInlineVars(objectStyle) }), _jsxs("div", { className: style.minimapInner, style: assignInlineVars(__assign({ transform: props.blockRotate
|
|
40
|
+
? "translate(-50%, -50%)"
|
|
41
|
+
: "translate(-50%, -50%) rotate(".concat((activeState.euler.y * 180) / Math.PI, "deg) ") }, innerStyle)), children: [_jsx("div", { className: style.direction({
|
|
40
42
|
east: true,
|
|
41
43
|
}), style: assignInlineVars(directionStyle), children: "E" }), _jsx("div", { className: style.direction({
|
|
42
44
|
west: true,
|
|
@@ -54,7 +56,7 @@ export function MiniMap(props) {
|
|
|
54
56
|
transform: "translate(-50%, -50%) translate(".concat(-X, "rem, ").concat(-Z, "rem)"),
|
|
55
57
|
transformOrigin: "50% 50%",
|
|
56
58
|
}), children: _jsx("div", { className: style.text, style: assignInlineVars(textStyle), children: text }) }, key));
|
|
57
|
-
}), _jsx("div", { className: style.avatar, style: assignInlineVars(avatarStyle) })] }), _jsxs("div", { className: style.scale, style: assignInlineVars(scaleStyle), children: [_jsx("div", { className: style.plusMinus, style: assignInlineVars(plusMinusStyle), onClick: function () {
|
|
59
|
+
}), _jsx("div", { className: style.avatar, style: assignInlineVars(avatarStyle) })] }), props.blockScaleControl && (_jsxs("div", { className: style.scale, style: assignInlineVars(scaleStyle), children: [_jsx("div", { className: style.plusMinus, style: assignInlineVars(plusMinusStyle), onClick: function () {
|
|
58
60
|
if (props.blockScale)
|
|
59
61
|
return;
|
|
60
62
|
downscale();
|
|
@@ -62,5 +64,5 @@ export function MiniMap(props) {
|
|
|
62
64
|
if (props.blockScale)
|
|
63
65
|
return;
|
|
64
66
|
upscale();
|
|
65
|
-
}, children: "-" })] })] }));
|
|
67
|
+
}, children: "-" })] }))] }));
|
|
66
68
|
}
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { useContext } from "react";
|
|
13
13
|
import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
|
|
14
14
|
export function usePushKey() {
|
|
15
|
-
var
|
|
15
|
+
var _a = useContext(GaesupWorldContext), control = _a.control, freeze = _a.freeze;
|
|
16
16
|
var dispatch = useContext(GaesupWorldDispatchContext);
|
|
17
17
|
var pushKey = function (key, value) {
|
|
18
18
|
control[key] = value;
|
|
@@ -3,6 +3,7 @@ export declare function gaesupWorldReducer(props: gaesupWorldContextType, action
|
|
|
3
3
|
type: string;
|
|
4
4
|
payload?: Partial<gaesupWorldContextType>;
|
|
5
5
|
}): {
|
|
6
|
+
freeze: boolean;
|
|
6
7
|
activeState: import("./type").activeStateType;
|
|
7
8
|
characterCollider: import("./type").characterColliderType;
|
|
8
9
|
vehicleCollider: import("./type").vehicleColliderType;
|
|
@@ -102,6 +102,7 @@ type KeyboardControlsState<T extends string = string> = {
|
|
|
102
102
|
[K in T]: boolean;
|
|
103
103
|
};
|
|
104
104
|
export type gaesupWorldContextType = {
|
|
105
|
+
freeze: boolean;
|
|
105
106
|
activeState: activeStateType;
|
|
106
107
|
characterCollider: characterColliderType;
|
|
107
108
|
vehicleCollider: vehicleColliderType;
|
|
@@ -3,6 +3,7 @@ import { gaesupWorldPropsType } from "../type";
|
|
|
3
3
|
export default function initGaesupWorld(props: gaesupWorldPropsType): {
|
|
4
4
|
gaesupProps: {
|
|
5
5
|
value: {
|
|
6
|
+
freeze: boolean;
|
|
6
7
|
activeState: import("../context/type").activeStateType;
|
|
7
8
|
characterCollider: import("../context/type").characterColliderType;
|
|
8
9
|
vehicleCollider: import("../context/type").vehicleColliderType;
|
|
@@ -17,6 +17,7 @@ import initColider from "./collider";
|
|
|
17
17
|
export default function initGaesupWorld(props) {
|
|
18
18
|
var _a = useReducer(gaesupWorldReducer, {
|
|
19
19
|
debug: props.debug || gaesupWorldDefault.debug,
|
|
20
|
+
freeze: props.freeze || false,
|
|
20
21
|
activeState: gaesupWorldDefault.activeState,
|
|
21
22
|
characterCollider: Object.assign(gaesupWorldDefault.characterCollider, props.characterCollider || {}),
|
|
22
23
|
vehicleCollider: Object.assign(gaesupWorldDefault.vehicleCollider, props.vehicleCollider || {}),
|