gaesup-world 0.8.38 → 0.8.39
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.
|
@@ -13,7 +13,6 @@ import { useKeyboardControls } from "@react-three/drei";
|
|
|
13
13
|
import { vec3 } from "@react-three/rapier";
|
|
14
14
|
import { useCallback, useContext, useEffect, useMemo } from "react";
|
|
15
15
|
import * as THREE from "three";
|
|
16
|
-
import { V3 } from "../../utils";
|
|
17
16
|
import { update } from "../../utils/context";
|
|
18
17
|
import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
|
|
19
18
|
export default function initControllerProps(props) {
|
|
@@ -47,32 +46,6 @@ export default function initControllerProps(props) {
|
|
|
47
46
|
});
|
|
48
47
|
}
|
|
49
48
|
}, [context === null || context === void 0 ? void 0 : context.mode.controller, keyControl, context === null || context === void 0 ? void 0 : context.control]);
|
|
50
|
-
// autoStart
|
|
51
|
-
useEffect(function () {
|
|
52
|
-
if (context === null || context === void 0 ? void 0 : context.clickerOption.autoStart) {
|
|
53
|
-
var u = context === null || context === void 0 ? void 0 : context.activeState.position;
|
|
54
|
-
var v = context === null || context === void 0 ? void 0 : context.clickerOption.queue.shift();
|
|
55
|
-
if (context === null || context === void 0 ? void 0 : context.clickerOption.loop) {
|
|
56
|
-
context === null || context === void 0 ? void 0 : context.clickerOption.queue.push(v);
|
|
57
|
-
}
|
|
58
|
-
var newAngle = Math.atan2(v.z - u.z, v.x - u.x);
|
|
59
|
-
context.clicker.angle = newAngle;
|
|
60
|
-
context.clicker.point = V3(v.x, 0, v.z);
|
|
61
|
-
context.clicker.isOn = true;
|
|
62
|
-
}
|
|
63
|
-
dispatch({
|
|
64
|
-
type: "update",
|
|
65
|
-
payload: {
|
|
66
|
-
clicker: __assign({}, context === null || context === void 0 ? void 0 : context.clicker),
|
|
67
|
-
clickerOption: __assign({}, context === null || context === void 0 ? void 0 : context.clickerOption),
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
}, [
|
|
71
|
-
context === null || context === void 0 ? void 0 : context.clicker,
|
|
72
|
-
context,
|
|
73
|
-
context === null || context === void 0 ? void 0 : context.clickerOption,
|
|
74
|
-
context === null || context === void 0 ? void 0 : context.clickerOption.autoStart,
|
|
75
|
-
]);
|
|
76
49
|
var groundRay = useMemo(function () {
|
|
77
50
|
return {
|
|
78
51
|
origin: vec3(),
|
|
@@ -14,14 +14,21 @@ import { vec3 } from "@react-three/rapier";
|
|
|
14
14
|
import { useContext, useEffect, useRef } from "react";
|
|
15
15
|
import * as THREE from "three";
|
|
16
16
|
import { useClicker } from "../hooks/useClicker";
|
|
17
|
+
import { useMovePoint } from "../hooks/useMovePoint";
|
|
17
18
|
import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/context";
|
|
18
19
|
export function GaeSupProps(_a) {
|
|
19
20
|
var _b = _a.type, type = _b === void 0 ? "normal" : _b, text = _a.text, position = _a.position, children = _a.children;
|
|
20
21
|
var groupRef = useRef(null);
|
|
21
|
-
var
|
|
22
|
+
var _c = useContext(GaesupWorldContext), minimap = _c.minimap, activeState = _c.activeState, clickerOption = _c.clickerOption;
|
|
22
23
|
var dispatch = useContext(GaesupWorldDispatchContext);
|
|
23
24
|
// clicker
|
|
24
|
-
var
|
|
25
|
+
var _d = useClicker(), moveClicker = _d.moveClicker, moveDoubleClicker = _d.moveDoubleClicker;
|
|
26
|
+
var move = useMovePoint().move;
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
if (clickerOption.autoStart) {
|
|
29
|
+
move(activeState.position, false);
|
|
30
|
+
}
|
|
31
|
+
}, [clickerOption.autoStart]);
|
|
25
32
|
useEffect(function () {
|
|
26
33
|
if (groupRef.current) {
|
|
27
34
|
var box = new THREE.Box3().setFromObject(groupRef.current);
|