update flow
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
ZoneDebugVisuals,
|
||||
ZoneDetection,
|
||||
} from "@/components/zone/ZoneDetection";
|
||||
import { GameFlow } from "@/components/game/GameFlow";
|
||||
import { DebugCameraControls } from "@/utils/debug/scene/DebugCameraControls";
|
||||
import { DebugHelpers } from "@/utils/debug/scene/DebugHelpers";
|
||||
import { Environment } from "@/world/Environment";
|
||||
@@ -34,6 +35,7 @@ export function World(): React.JSX.Element {
|
||||
<DebugHelpers />
|
||||
<ZoneDetection />
|
||||
<ZoneDebugVisuals />
|
||||
<GameFlow />
|
||||
{cameraMode === "debug" ? <DebugCameraControls /> : null}
|
||||
|
||||
{sceneMode === "game" ? (
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
PLAYER_XZ_DAMPING_FACTOR,
|
||||
} from "@/data/playerConfig";
|
||||
import { InteractionManager } from "@/stateManager/InteractionManager";
|
||||
import { GameStepManager } from "@/stateManager/GameStepManager";
|
||||
import type { Vector3Tuple } from "@/types/3d";
|
||||
|
||||
type Keys = {
|
||||
@@ -63,6 +64,7 @@ export function PlayerController({
|
||||
const velocity = useRef(new THREE.Vector3());
|
||||
const onFloor = useRef(false);
|
||||
const wantsJump = useRef(false);
|
||||
const gameStepManager = GameStepManager.getInstance();
|
||||
|
||||
const capsule = useRef(
|
||||
new Capsule(
|
||||
@@ -165,6 +167,12 @@ export function PlayerController({
|
||||
}, []);
|
||||
|
||||
useFrame((_, delta) => {
|
||||
if (!gameStepManager.canMove()) {
|
||||
velocity.current.set(0, 0, 0);
|
||||
camera.position.copy(capsule.current.end);
|
||||
return;
|
||||
}
|
||||
|
||||
const dt = Math.min(delta, PLAYER_MAX_DELTA);
|
||||
|
||||
camera.getWorldDirection(_forward);
|
||||
|
||||
Reference in New Issue
Block a user