update flow

This commit is contained in:
math-pixel
2026-05-11 11:03:01 +02:00
parent 41f7b2ad19
commit 1b7813a5bb
11 changed files with 415 additions and 6 deletions
+2
View File
@@ -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" ? (
+8
View File
@@ -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);