gaesup-world 0.0.71 → 0.0.72
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.
|
@@ -15,12 +15,20 @@ import { useContext, useEffect } from "react";
|
|
|
15
15
|
import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/context";
|
|
16
16
|
export function usePlayActions() {
|
|
17
17
|
var _a = useContext(GaesupWorldContext), characterGltf = _a.characterGltf, vehicleGltf = _a.vehicleGltf, airplaneGltf = _a.airplaneGltf, animations = _a.animations;
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
var resultRef = {
|
|
19
|
+
character: null,
|
|
20
|
+
vehicle: null,
|
|
21
|
+
airplane: null,
|
|
22
|
+
};
|
|
23
|
+
if (characterGltf && characterGltf.animations) {
|
|
24
|
+
resultRef.character = useAnimations(characterGltf.animations);
|
|
25
|
+
}
|
|
26
|
+
if (vehicleGltf && vehicleGltf.animations) {
|
|
27
|
+
resultRef.vehicle = useAnimations(vehicleGltf.animations);
|
|
28
|
+
}
|
|
29
|
+
if (airplaneGltf && airplaneGltf.animations) {
|
|
30
|
+
resultRef.airplane = useAnimations(airplaneGltf.animations);
|
|
31
|
+
}
|
|
24
32
|
var dispatch = useContext(GaesupWorldDispatchContext);
|
|
25
33
|
var play = function (tag) {
|
|
26
34
|
animations.current = tag;
|
|
@@ -43,11 +51,6 @@ export function usePlayActions() {
|
|
|
43
51
|
},
|
|
44
52
|
});
|
|
45
53
|
};
|
|
46
|
-
var resultRef = {
|
|
47
|
-
character: characterResult,
|
|
48
|
-
vehicle: vehicleResult,
|
|
49
|
-
airplane: airplaneResult,
|
|
50
|
-
};
|
|
51
54
|
return { resultRef: resultRef, play: play, setAnimationName: setAnimationName };
|
|
52
55
|
}
|
|
53
56
|
export default function playCharacterActions(_a) {
|
|
@@ -19,19 +19,20 @@ export default function initControllerProps(_a) {
|
|
|
19
19
|
var controllerContext = _a.controllerContext, refs = _a.refs;
|
|
20
20
|
var context = useContext(GaesupWorldContext);
|
|
21
21
|
var dispatch = useContext(GaesupWorldDispatchContext);
|
|
22
|
-
var _b =
|
|
23
|
-
var _c = useKeyboardControls(), _ = _c[0], getKeys = _c[1];
|
|
22
|
+
var _b = useKeyboardControls(), _ = _b[0], getKeys = _b[1];
|
|
24
23
|
var keyControl = getKeys();
|
|
25
24
|
useEffect(function () {
|
|
26
|
-
if (keyControl && control) {
|
|
25
|
+
if (context && keyControl && context.control) {
|
|
27
26
|
dispatch({
|
|
28
27
|
type: "update",
|
|
29
28
|
payload: {
|
|
30
|
-
control: __assign({}, (mode.controller === "keyboard"
|
|
29
|
+
control: __assign({}, (context.mode.controller === "keyboard"
|
|
30
|
+
? keyControl
|
|
31
|
+
: context.control)),
|
|
31
32
|
},
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
|
-
}, [mode.controller, keyControl, control]);
|
|
35
|
+
}, [context.mode.controller, keyControl, context.control]);
|
|
35
36
|
var groundRay = useMemo(function () {
|
|
36
37
|
return {
|
|
37
38
|
origin: vec3(),
|