mirror of
https://github.com/ad044/lainTSX.git
synced 2024-10-22 23:19:06 +00:00
testing around idle nodes trying to find an optimal way to make this shit work
This commit is contained in:
parent
2bf0a047e0
commit
908479f21a
8 changed files with 20 additions and 38 deletions
|
@ -1,11 +1,11 @@
|
||||||
import React, { useEffect, useState, Suspense, useMemo } from "react";
|
import React, { Suspense, useEffect, useMemo } from "react";
|
||||||
import MainScene from "./scenes/MainScene";
|
import MainScene from "./scenes/MainScene";
|
||||||
import "./static/css/page.css";
|
import "./static/css/page.css";
|
||||||
import { Canvas } from "react-three-fiber";
|
import { Canvas } from "react-three-fiber";
|
||||||
import MediaPlayer from "./components/MediaScene/MediaPlayer";
|
import MediaPlayer from "./components/MediaScene/MediaPlayer";
|
||||||
import MediaScene from "./scenes/MediaScene";
|
import MediaScene from "./scenes/MediaScene";
|
||||||
import EventManager from "./core/StateManagers/EventManager";
|
import EventManager from "./core/StateManagers/EventManager";
|
||||||
import { useMediaStore, useSceneStore } from "./store";
|
import { useSceneStore } from "./store";
|
||||||
import GateScene from "./scenes/GateScene";
|
import GateScene from "./scenes/GateScene";
|
||||||
import BootScene from "./scenes/BootScene";
|
import BootScene from "./scenes/BootScene";
|
||||||
import SSknScene from "./scenes/SSknScene";
|
import SSknScene from "./scenes/SSknScene";
|
||||||
|
|
|
@ -204,10 +204,6 @@ const MiddleRing = () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log(mainRingVisible);
|
|
||||||
}, [mainRingVisible]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a.group rotation-z={rotState.rotZ}>
|
<a.group rotation-z={rotState.rotZ}>
|
||||||
<a.mesh
|
<a.mesh
|
||||||
|
|
|
@ -69,9 +69,7 @@ const MediaPlayer = () => {
|
||||||
setPercentageElapsed(percentageElapsed);
|
setPercentageElapsed(percentageElapsed);
|
||||||
if (percentageElapsed === 100) {
|
if (percentageElapsed === 100) {
|
||||||
videoRef.current.currentTime = 0;
|
videoRef.current.currentTime = 0;
|
||||||
if (currentScene === "idle_media") {
|
if (currentScene === "end") {
|
||||||
setScene("main");
|
|
||||||
} else if (currentScene === "end") {
|
|
||||||
incrementEndMediaPlayedCount();
|
incrementEndMediaPlayedCount();
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
|
@ -179,9 +177,6 @@ const MediaPlayer = () => {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (videoRef.current) {
|
|
||||||
videoRef.current.play();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,6 +146,7 @@ const EventManager = () => {
|
||||||
if (
|
if (
|
||||||
timePassedSinceLastKeyPress.current > -1 &&
|
timePassedSinceLastKeyPress.current > -1 &&
|
||||||
mainSubscene !== "pause" &&
|
mainSubscene !== "pause" &&
|
||||||
|
mainSubscene !== "level_selection" &&
|
||||||
currentScene === "main"
|
currentScene === "main"
|
||||||
) {
|
) {
|
||||||
if (now > timePassedSinceLastKeyPress.current + 10000) {
|
if (now > timePassedSinceLastKeyPress.current + 10000) {
|
||||||
|
@ -191,10 +192,10 @@ const EventManager = () => {
|
||||||
const keyPress = getKeyCodeAssociation(keyCode);
|
const keyPress = getKeyCodeAssociation(keyCode);
|
||||||
|
|
||||||
if (keyPress && !inputCooldown) {
|
if (keyPress && !inputCooldown) {
|
||||||
timePassedSinceLastKeyPress.current = Date.now() + 2500;
|
|
||||||
let event;
|
let event;
|
||||||
switch (currentScene) {
|
switch (currentScene) {
|
||||||
case "main":
|
case "main":
|
||||||
|
timePassedSinceLastKeyPress.current = Date.now() + 2500;
|
||||||
event = handleMainSceneEvent({
|
event = handleMainSceneEvent({
|
||||||
mainSubscene: mainSubscene,
|
mainSubscene: mainSubscene,
|
||||||
keyPress: keyPress,
|
keyPress: keyPress,
|
||||||
|
@ -210,6 +211,7 @@ const EventManager = () => {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "media":
|
case "media":
|
||||||
|
case "idle_media":
|
||||||
event = handleMediaSceneEvent({
|
event = handleMediaSceneEvent({
|
||||||
keyPress: keyPress,
|
keyPress: keyPress,
|
||||||
activeMediaComponent: activeMediaComponent,
|
activeMediaComponent: activeMediaComponent,
|
||||||
|
|
|
@ -83,8 +83,6 @@ const IdleManager = (props: StateManagerProps) => {
|
||||||
idleNodes.video[Math.floor(Math.random() * idleNodes.video.length)]
|
idleNodes.video[Math.floor(Math.random() * idleNodes.video.length)]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('s')
|
|
||||||
},
|
},
|
||||||
[setImages, setMedia]
|
[setImages, setMedia]
|
||||||
);
|
);
|
||||||
|
|
|
@ -62,28 +62,18 @@ const MediaScene = () => {
|
||||||
return (
|
return (
|
||||||
<perspectiveCamera position-z={3}>
|
<perspectiveCamera position-z={3}>
|
||||||
<group position={[0.4, -0.3, 0]}>
|
<group position={[0.4, -0.3, 0]}>
|
||||||
{currentScene !== "idle_media" ? (
|
<pointLight intensity={1.2} color={0xffffff} position={[-2, 0, 0]} />
|
||||||
<>
|
<LeftSide activeMediaComponent={activeMediaComponent} />
|
||||||
<pointLight
|
<group position={[0, 0.5, -3]}>
|
||||||
intensity={1.2}
|
<MediaLoadingBar />
|
||||||
color={0xffffff}
|
<NodeNameContainer />
|
||||||
position={[-2, 0, 0]}
|
</group>
|
||||||
/>
|
<group scale={[0.06, 0.12, 0]} position={[0.8, 1.37, 0]}>
|
||||||
<LeftSide activeMediaComponent={activeMediaComponent} />
|
{activeNodeName.split("").map((letter, idx) => (
|
||||||
<group position={[0, 0.5, -3]}>
|
<MediumLetter letter={letter} letterIdx={idx} key={idx} />
|
||||||
<MediaLoadingBar />
|
))}
|
||||||
<NodeNameContainer />
|
</group>
|
||||||
</group>
|
<MediaYellowTextAnimator />
|
||||||
<group scale={[0.06, 0.12, 0]} position={[0.8, 1.37, 0]}>
|
|
||||||
{activeNodeName.split("").map((letter, idx) => (
|
|
||||||
<MediumLetter letter={letter} letterIdx={idx} key={idx} />
|
|
||||||
))}
|
|
||||||
</group>
|
|
||||||
<MediaYellowTextAnimator />
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
|
||||||
{activeNodeMedia.includes("XA") || idleMedia.includes("XA") ? (
|
{activeNodeMedia.includes("XA") || idleMedia.includes("XA") ? (
|
||||||
<>
|
<>
|
||||||
{currentScene !== "idle_media" ? (
|
{currentScene !== "idle_media" ? (
|
||||||
|
|
|
@ -35,6 +35,7 @@ const TaKScene = () => {
|
||||||
setAudioAnalyser(new THREE.AudioAnalyser(audio, 2048));
|
setAudioAnalyser(new THREE.AudioAnalyser(audio, 2048));
|
||||||
|
|
||||||
if (mediaElement) {
|
if (mediaElement) {
|
||||||
|
mediaElement.currentTime = 0;
|
||||||
mediaElement.play();
|
mediaElement.play();
|
||||||
setIsIntro(false);
|
setIsIntro(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,7 +338,7 @@ export const useNodeStore = create(
|
||||||
);
|
);
|
||||||
|
|
||||||
export const useIdleStore = create<IdleState>((set) => ({
|
export const useIdleStore = create<IdleState>((set) => ({
|
||||||
media: undefined,
|
media: "INS01.STR",
|
||||||
// this may be undefined depending on whether or not the media is audio or not
|
// this may be undefined depending on whether or not the media is audio or not
|
||||||
images: undefined,
|
images: undefined,
|
||||||
setMedia: (to) => set(() => ({ media: to })),
|
setMedia: (to) => set(() => ({ media: to })),
|
||||||
|
|
Loading…
Reference in a new issue