Merge branch 'develop' into feat/polish-mission-2
🔍 Lint / 🪄 Check lint (pull_request) Has been cancelled
🔍 Lint / 🎨 Check format (pull_request) Has been cancelled
🔍 Lint / 🔎 Typecheck (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
🔍 Lint / 🏗 Build (pull_request) Has been cancelled
🔍 Lint / 🪄 Check lint (pull_request) Has been cancelled
🔍 Lint / 🎨 Check format (pull_request) Has been cancelled
🔍 Lint / 🔎 Typecheck (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
🔍 Lint / 🏗 Build (pull_request) Has been cancelled
This commit is contained in:
+31
-2
@@ -1,14 +1,43 @@
|
||||
import { useEffect } from "react";
|
||||
import { AudioManager } from "@/managers/AudioManager";
|
||||
import { useGameStore } from "@/managers/stores/useGameStore";
|
||||
import type { MissionStep } from "@/types/gameplay/repairMission";
|
||||
|
||||
const GAME_MUSIC_PATH = "/sounds/musique/musique-jeu.mp3";
|
||||
const GAME_MUSIC_VOLUME = 0.33;
|
||||
const REPAIR_MUSIC_PATH = "/sounds/musique/musique-reparation.mp3";
|
||||
const MUSIC_VOLUME = 0.33;
|
||||
|
||||
// Steps during which the repair mini-game owns the experience.
|
||||
// Triggered when any mission (ebike / pylon / farm) is in this range.
|
||||
const REPAIR_MUSIC_STEPS: ReadonlySet<MissionStep> = new Set([
|
||||
"inspected",
|
||||
"fragmented",
|
||||
"scanning",
|
||||
"repairing",
|
||||
"reassembling",
|
||||
"done",
|
||||
]);
|
||||
|
||||
export function GameMusic(): null {
|
||||
const ebikeStep = useGameStore((state) => state.ebike.currentStep);
|
||||
const pylonStep = useGameStore((state) => state.pylon.currentStep);
|
||||
const farmStep = useGameStore((state) => state.farm.currentStep);
|
||||
|
||||
const inRepair =
|
||||
REPAIR_MUSIC_STEPS.has(ebikeStep) ||
|
||||
REPAIR_MUSIC_STEPS.has(pylonStep) ||
|
||||
REPAIR_MUSIC_STEPS.has(farmStep);
|
||||
|
||||
useEffect(() => {
|
||||
const audio = AudioManager.getInstance();
|
||||
audio.playMusic(GAME_MUSIC_PATH, GAME_MUSIC_VOLUME);
|
||||
audio.playMusic(
|
||||
inRepair ? REPAIR_MUSIC_PATH : GAME_MUSIC_PATH,
|
||||
MUSIC_VOLUME,
|
||||
);
|
||||
}, [inRepair]);
|
||||
|
||||
useEffect(() => {
|
||||
const audio = AudioManager.getInstance();
|
||||
return () => {
|
||||
audio.stopMusic();
|
||||
};
|
||||
|
||||
@@ -363,7 +363,11 @@ export function PlayerController({
|
||||
}
|
||||
|
||||
_wishDir.set(0, 0, 0);
|
||||
if (!isEbikeBreakdown) {
|
||||
// Block drive input only when still on the bike during breakdown.
|
||||
// Once auto-dismounted (movementMode === "walk"), the player must
|
||||
// remain free to walk around even though ebikeBreakdownActive is true.
|
||||
const blockDriveInput = isEbikeMounted && isEbikeBreakdown;
|
||||
if (!blockDriveInput) {
|
||||
if (keys.current.forward) _wishDir.add(_forward);
|
||||
if (keys.current.backward) _wishDir.sub(_forward);
|
||||
if (!isEbikeMounted) {
|
||||
|
||||
Reference in New Issue
Block a user