fix : lint
🔍 Lint / 🪄 Check lint (pull_request) Has been cancelled
🔍 Lint / 🎨 Check format (pull_request) Has been cancelled
🔍 Lint / 🔎 Typecheck (pull_request) Has been cancelled
🔍 Lint / 🏗 Build (pull_request) Has been cancelled
📊 Quality / 🔒 Security Audit (pull_request) Has been cancelled
📊 Quality / 📋 Dependency Freshness (pull_request) Has been cancelled
📊 Quality / 📦 Bundle Size (pull_request) Has been cancelled

This commit is contained in:
math-pixel
2026-05-12 16:51:35 +02:00
parent 700c088c48
commit ceffedf684
8 changed files with 93 additions and 156 deletions
+1 -17
View File
@@ -11,22 +11,16 @@ export function GameFlow(): null {
const hasInitialized = useRef(false);
useEffect(() => {
console.log("[GameFlow] Current step:", step);
if (!hasInitialized.current && step === "intro") {
hasInitialized.current = true;
console.log("[GameFlow] Transition to start-intro");
setStep("start-intro");
}
}, [step, setStep]);
useEffect(() => {
console.log("[GameFlow] useEffect triggered, step:", step);
if (step === "start-intro") {
console.log("[GameFlow] Playing intro audio");
const audio = AudioManager.getInstance();
audio.playSoundWithCallback(AUDIO_PATHS.intro, 0.5, () => {
console.log("[GameFlow] Intro audio ended, transition to naming");
setStep("naming");
});
@@ -34,10 +28,8 @@ export function GameFlow(): null {
}
if (step === "bienvenue") {
console.log("[GameFlow] Playing bienvenue audio");
const audio = AudioManager.getInstance();
audio.playSoundWithCallback(AUDIO_PATHS.bienvenue, 0.5, () => {
console.log("[GameFlow] Bienvenue audio ended, enable movement");
setCanMove(true);
setStep("star-move");
});
@@ -46,30 +38,22 @@ export function GameFlow(): null {
}
if (step === "mission2") {
console.log("[GameFlow] mission2 - setting activityCity to false");
setActivityCity(false);
const audio = AudioManager.getInstance();
audio.playSound(AUDIO_PATHS.alertCentral, 0.5);
}
if (step === "searching") {
console.log("[GameFlow] Playing searching audio");
const audio = AudioManager.getInstance();
audio.playSoundWithCallback(AUDIO_PATHS.searching, 0.5, () => {
console.log("[GameFlow] searching audio ended");
});
return () => {};
audio.playSound(AUDIO_PATHS.searching, 0.5);
}
if (step === "helped") {
console.log("[GameFlow] Playing helped audio");
const audio = AudioManager.getInstance();
audio.playSound(AUDIO_PATHS.helped, 0.5);
}
if (step === "manipulation") {
console.log("[GameFlow] manipulation - blocking movement");
setCanMove(false);
}
+2 -5
View File
@@ -12,11 +12,8 @@ export function IntroUI(): React.JSX.Element | null {
const handleSubmit = (): void => {
if (inputValue.trim() === "") return;
console.log("[IntroUI] Submitting, name:", inputValue.trim());
setPlayerName(inputValue.trim());
console.log("[IntroUI] Calling transitionTo('bienvenue')");
setStep("bienvenue");
console.log("[IntroUI] After transitionTo, step should be:", step);
};
const handleKeyDown = (e: React.KeyboardEvent): void => {
@@ -59,14 +56,14 @@ export function IntroUI(): React.JSX.Element | null {
textAlign: "center",
}}
>
Quel est votre prénom ?
Quel est votre prenom ?
</h2>
<input
type="text"
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
onKeyDown={handleKeyDown}
placeholder="Votre prénom"
placeholder="Votre prenom"
autoFocus
style={{
padding: "0.75rem",
@@ -4,20 +4,7 @@ import {
useGameStore,
} from "@/managers/stores/useGameStore";
import { isMissionStep, MISSION_STEPS } from "@/types/gameplay/repairMission";
import { type GameStep } from "@/types/game";
const GAME_STEPS: GameStep[] = [
"intro",
"start-intro",
"naming",
"bienvenue",
"star-move",
"mission2",
"searching",
"helped",
"manipulation",
"outOfFabrik",
];
import { GAME_STEPS, type GameStep } from "@/types/game";
const MAIN_STATES: MainGameState[] = [
"intro",
+34 -49
View File
@@ -4,24 +4,11 @@ import * as THREE from "three";
import { ZONES } from "@/data/zones";
import { useGameStore } from "@/managers/stores/useGameStore";
import { Debug } from "@/utils/debug/Debug";
import type { GameStep } from "@/types/game";
import { GAME_STEPS } from "@/types/game";
const _playerPos = new THREE.Vector3();
const _zonePos = new THREE.Vector3();
const GAME_STEPS: GameStep[] = [
"intro",
"start-intro",
"naming",
"bienvenue",
"star-move",
"mission2",
"searching",
"helped",
"manipulation",
"outOfFabrik",
];
export function ZoneDetection(): null {
const camera = useThree((state) => state.camera);
const triggeredZones = useRef<Set<string>>(new Set());
@@ -88,41 +75,6 @@ export function ZoneDetection(): null {
return null;
}
interface ZoneVisualProps {
position: [number, number, number];
radius: number;
height: number;
triggered: boolean;
}
function ZoneVisual({
position,
radius,
height,
triggered,
}: ZoneVisualProps): React.JSX.Element {
const color = triggered ? "#00ff00" : "#ff0000";
return (
<group position={position}>
<mesh rotation={[-Math.PI / 2, 0, 0]}>
<ringGeometry args={[radius - 0.3, radius, 32]} />
<meshBasicMaterial color={color} side={THREE.DoubleSide} />
</mesh>
<mesh position={[0, height / 2, 0]}>
<cylinderGeometry args={[radius, radius, height, 32, 1, true]} />
<meshBasicMaterial
color={color}
transparent
opacity={0.15}
side={THREE.DoubleSide}
depthWrite={false}
/>
</mesh>
</group>
);
}
export function ZoneDebugVisuals(): React.JSX.Element | null {
const debug = Debug.getInstance();
const camera = useThree((state) => state.camera);
@@ -161,3 +113,36 @@ export function ZoneDebugVisuals(): React.JSX.Element | null {
</>
);
}
function ZoneVisual({
position,
radius,
height,
triggered,
}: {
position: [number, number, number];
radius: number;
height: number;
triggered: boolean;
}): React.JSX.Element {
const color = triggered ? "#00ff00" : "#ff0000";
return (
<group position={position}>
<mesh rotation={[-Math.PI / 2, 0, 0]}>
<ringGeometry args={[radius - 0.3, radius, 32]} />
<meshBasicMaterial color={color} side={THREE.DoubleSide} />
</mesh>
<mesh position={[0, height / 2, 0]}>
<cylinderGeometry args={[radius, radius, height, 32, 1, true]} />
<meshBasicMaterial
color={color}
transparent
opacity={0.15}
side={THREE.DoubleSide}
depthWrite={false}
/>
</mesh>
</group>
);
}