gaesup-world 0.8.35 → 0.8.37

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.
@@ -9,33 +9,12 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { useContext, useEffect } from "react";
12
+ import { useContext } from "react";
13
13
  import { V3 } from "../../utils";
14
14
  import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
15
15
  export function useClicker() {
16
16
  var _a = useContext(GaesupWorldContext), activeState = _a.activeState, mode = _a.mode, clicker = _a.clicker, clickerOption = _a.clickerOption;
17
17
  var dispatch = useContext(GaesupWorldDispatchContext);
18
- // autoStart
19
- useEffect(function () {
20
- if (clickerOption.autoStart) {
21
- var u = activeState.position;
22
- var v = clickerOption.queue.shift();
23
- if (clickerOption.loop) {
24
- clickerOption.queue.push(v);
25
- }
26
- var newAngle = Math.atan2(v.z - u.z, v.x - u.x);
27
- clicker.angle = newAngle;
28
- clicker.point = V3(v.x, 0, v.z);
29
- clicker.isOn = true;
30
- }
31
- dispatch({
32
- type: "update",
33
- payload: {
34
- clicker: __assign({}, clicker),
35
- clickerOption: __assign({}, clickerOption),
36
- },
37
- });
38
- }, [clickerOption.autoStart]);
39
18
  var moveClicker = function (e, isRun, type) {
40
19
  if (mode.controller !== "clicker" || type !== "ground")
41
20
  return;
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { useEffect, useMemo, useReducer } from "react";
13
13
  import { isDesktop } from "react-device-detect";
14
+ import { V3 } from "../../utils";
14
15
  import { gaesupWorldDefault } from "../../world/context";
15
16
  import { gaesupWorldReducer } from "../../world/context/reducer";
16
17
  import initDebug from "../debug";
@@ -34,6 +35,27 @@ export default function initGaesupWorld(props) {
34
35
  block: Object.assign(gaesupWorldDefault.block, props.block || {}),
35
36
  sizes: gaesupWorldDefault.sizes,
36
37
  }), value = _a[0], dispatch = _a[1];
38
+ // autoStart
39
+ useEffect(function () {
40
+ if (value.clickerOption.autoStart) {
41
+ var u = value.activeState.position;
42
+ var v = value.clickerOption.queue.shift();
43
+ if (value.clickerOption.loop) {
44
+ value.clickerOption.queue.push(v);
45
+ }
46
+ var newAngle = Math.atan2(v.z - u.z, v.x - u.x);
47
+ value.clicker.angle = newAngle;
48
+ value.clicker.point = V3(v.x, 0, v.z);
49
+ value.clicker.isOn = true;
50
+ }
51
+ dispatch({
52
+ type: "update",
53
+ payload: {
54
+ clicker: __assign({}, value.clicker),
55
+ clickerOption: __assign({}, value.clickerOption),
56
+ },
57
+ });
58
+ }, [value.clickerOption.autoStart]);
37
59
  useEffect(function () {
38
60
  var _a;
39
61
  var keyboard = (_a = value.keyBoardMap) === null || _a === void 0 ? void 0 : _a.reduce(function (maps, keyboardMapItem) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaesup-world",
3
- "version": "0.8.35",
3
+ "version": "0.8.37",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",