update: stabilize repair mission stage mounting
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { RepairGame } from "@/components/three/gameplay/RepairGame";
|
import { RepairGame } from "@/components/three/gameplay/RepairGame";
|
||||||
import { useGameStore } from "@/managers/stores/useGameStore";
|
import { useGameStore } from "@/managers/stores/useGameStore";
|
||||||
|
import type { RepairMissionId } from "@/types/gameplay/repairMission";
|
||||||
import type { Vector3Tuple } from "@/types/three/three";
|
import type { Vector3Tuple } from "@/types/three/three";
|
||||||
|
|
||||||
interface StageAnchorProps {
|
interface StageAnchorProps {
|
||||||
@@ -8,6 +9,26 @@ interface StageAnchorProps {
|
|||||||
scale?: number;
|
scale?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface GameRepairZone {
|
||||||
|
mission: RepairMissionId;
|
||||||
|
position: Vector3Tuple;
|
||||||
|
}
|
||||||
|
|
||||||
|
const GAME_REPAIR_ZONES = [
|
||||||
|
{
|
||||||
|
mission: "bike",
|
||||||
|
position: [8, 0, -6],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
mission: "pylone",
|
||||||
|
position: [64, 0, -66],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
mission: "ferme",
|
||||||
|
position: [-24, 0, 42],
|
||||||
|
},
|
||||||
|
] as const satisfies readonly GameRepairZone[];
|
||||||
|
|
||||||
function StageAnchor({
|
function StageAnchor({
|
||||||
color,
|
color,
|
||||||
position,
|
position,
|
||||||
@@ -30,16 +51,21 @@ function StageAnchor({
|
|||||||
export function GameStageContent(): React.JSX.Element {
|
export function GameStageContent(): React.JSX.Element {
|
||||||
const mainState = useGameStore((state) => state.mainState);
|
const mainState = useGameStore((state) => state.mainState);
|
||||||
|
|
||||||
switch (mainState) {
|
return (
|
||||||
case "intro":
|
<>
|
||||||
return <StageAnchor color="#7dd3fc" position={[0, 4, 0]} />;
|
{mainState === "intro" ? (
|
||||||
case "bike":
|
<StageAnchor color="#7dd3fc" position={[0, 4, 0]} />
|
||||||
return <RepairGame mission="bike" position={[8, 0, -6]} />;
|
) : null}
|
||||||
case "pylone":
|
{GAME_REPAIR_ZONES.map((zone) => (
|
||||||
return <RepairGame mission="pylone" position={[64, 0, -66]} />;
|
<RepairGame
|
||||||
case "ferme":
|
key={zone.mission}
|
||||||
return <RepairGame mission="ferme" position={[-24, 0, 42]} />;
|
mission={zone.mission}
|
||||||
case "outro":
|
position={zone.position}
|
||||||
return <StageAnchor color="#fb7185" position={[0, 6, 10]} scale={1.25} />;
|
/>
|
||||||
}
|
))}
|
||||||
|
{mainState === "outro" ? (
|
||||||
|
<StageAnchor color="#fb7185" position={[0, 6, 10]} scale={1.25} />
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user