feat: video player

This commit is contained in:
math-pixel
2026-05-14 11:35:03 +02:00
parent 3222d2ed3d
commit 3ece1d76de
3 changed files with 94 additions and 0 deletions
+12
View File
@@ -29,6 +29,7 @@ interface MissionFlowState {
canMove: boolean;
dialogMessage: string | null;
playerName: string;
currentVideo: string | null;
}
interface GameState {
@@ -78,6 +79,8 @@ interface GameActions {
rewindGameState: () => void;
resetGame: () => void;
showDialog: (dialogMessage: string) => void;
playVideo: (videoSrc: string) => void;
clearVideo: () => void;
}
type GameStore = GameState & GameActions;
@@ -233,6 +236,7 @@ function createInitialGameState(): GameState {
canMove: false,
dialogMessage: null,
playerName: "",
currentVideo: null,
},
intro: {
currentStep: "intro",
@@ -342,4 +346,12 @@ export const useGameStore = create<GameStore>()((set) => ({
set((state) => ({
missionFlow: { ...state.missionFlow, dialogMessage },
})),
playVideo: (videoSrc) =>
set((state) => ({
missionFlow: { ...state.missionFlow, currentVideo: videoSrc },
})),
clearVideo: () =>
set((state) => ({
missionFlow: { ...state.missionFlow, currentVideo: null },
})),
}));