Integrate and manage runtime schedule synchronization context in RuntimeHost
This commit is contained in:
@@ -191,9 +191,11 @@ import {
|
|||||||
type DialogueAttentionSideSign
|
type DialogueAttentionSideSign
|
||||||
} from "./dialogue-attention-camera";
|
} from "./dialogue-attention-camera";
|
||||||
import {
|
import {
|
||||||
applyRuntimeProjectScheduleToControlState,
|
commitRuntimeScheduleSyncResult,
|
||||||
resolveRuntimeProjectScheduleState
|
createRuntimeScheduleSyncContext,
|
||||||
} from "./runtime-project-scheduler";
|
syncRuntimeSceneScheduleToClock,
|
||||||
|
type RuntimeScheduleSyncContext
|
||||||
|
} from "./runtime-schedule-sync";
|
||||||
import {
|
import {
|
||||||
THIRD_PERSON_CAMERA_COLLISION_RADIUS,
|
THIRD_PERSON_CAMERA_COLLISION_RADIUS,
|
||||||
ThirdPersonNavigationController
|
ThirdPersonNavigationController
|
||||||
@@ -212,11 +214,6 @@ import type {
|
|||||||
RuntimeTerrain,
|
RuntimeTerrain,
|
||||||
RuntimeTeleportTarget
|
RuntimeTeleportTarget
|
||||||
} from "./runtime-scene-build";
|
} from "./runtime-scene-build";
|
||||||
import {
|
|
||||||
applyActorScheduleStateToNpcDefinition,
|
|
||||||
buildRuntimeNpcCollider,
|
|
||||||
createRuntimeNpcFromDefinition
|
|
||||||
} from "./runtime-scene-build";
|
|
||||||
import {
|
import {
|
||||||
resolveDefaultTargetCycleInput,
|
resolveDefaultTargetCycleInput,
|
||||||
resolvePlayerStartClearTargetInput,
|
resolvePlayerStartClearTargetInput,
|
||||||
@@ -534,10 +531,6 @@ function dampAngleDegrees(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNonNull<T>(value: T | null): value is T {
|
|
||||||
return value !== null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RuntimeSceneLoadState {
|
export interface RuntimeSceneLoadState {
|
||||||
status: "loading" | "ready" | "error";
|
status: "loading" | "ready" | "error";
|
||||||
message: string | null;
|
message: string | null;
|
||||||
@@ -740,6 +733,7 @@ export class RuntimeHost {
|
|||||||
private desiredNavigationMode: RuntimeNavigationMode = "thirdPerson";
|
private desiredNavigationMode: RuntimeNavigationMode = "thirdPerson";
|
||||||
private sceneReady = false;
|
private sceneReady = false;
|
||||||
private currentWorld: RuntimeSceneDefinition["world"] | null = null;
|
private currentWorld: RuntimeSceneDefinition["world"] | null = null;
|
||||||
|
private runtimeScheduleSyncContext: RuntimeScheduleSyncContext | null = null;
|
||||||
private currentAdvancedRenderingSettings: AdvancedRenderingSettings | null =
|
private currentAdvancedRenderingSettings: AdvancedRenderingSettings | null =
|
||||||
null;
|
null;
|
||||||
private advancedRenderingComposer: EffectComposer | null = null;
|
private advancedRenderingComposer: EffectComposer | null = null;
|
||||||
@@ -1082,6 +1076,8 @@ export class RuntimeHost {
|
|||||||
|
|
||||||
this.sceneReady = false;
|
this.sceneReady = false;
|
||||||
this.runtimeScene = runtimeScene;
|
this.runtimeScene = runtimeScene;
|
||||||
|
this.runtimeScheduleSyncContext =
|
||||||
|
createRuntimeScheduleSyncContext(runtimeScene);
|
||||||
this.currentWorld = runtimeScene.world;
|
this.currentWorld = runtimeScene.world;
|
||||||
this.activeScheduledImpulseRoutineIds.clear();
|
this.activeScheduledImpulseRoutineIds.clear();
|
||||||
this.syncRuntimeClockState(runtimeScene.time);
|
this.syncRuntimeClockState(runtimeScene.time);
|
||||||
@@ -1335,6 +1331,7 @@ export class RuntimeHost {
|
|||||||
this.advancedRenderingComposer = null;
|
this.advancedRenderingComposer = null;
|
||||||
this.currentAdvancedRenderingSettings = null;
|
this.currentAdvancedRenderingSettings = null;
|
||||||
this.scene.fog = null;
|
this.scene.fog = null;
|
||||||
|
this.runtimeScheduleSyncContext = null;
|
||||||
this.currentClockState = null;
|
this.currentClockState = null;
|
||||||
this.lastPublishedClockState = null;
|
this.lastPublishedClockState = null;
|
||||||
this.activeScheduledImpulseRoutineIds.clear();
|
this.activeScheduledImpulseRoutineIds.clear();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
export interface RuntimeScheduleSyncContext {
|
export interface RuntimeScheduleSyncContext {
|
||||||
readonly runtimeScene: RuntimeSceneDefinition;
|
readonly runtimeScene: RuntimeSceneDefinition;
|
||||||
readonly pathsById: ReadonlyMap<string, RuntimeSceneDefinition["paths"][number]>;
|
readonly pathsById: ReadonlyMap<string, RuntimeSceneDefinition["paths"][number]>;
|
||||||
readonly actorIds: readonly string[];
|
readonly actorIds: string[];
|
||||||
readonly actorStatesByActorId: ReadonlyMap<
|
readonly actorStatesByActorId: ReadonlyMap<
|
||||||
string,
|
string,
|
||||||
RuntimeResolvedActorScheduleState
|
RuntimeResolvedActorScheduleState
|
||||||
@@ -214,7 +214,7 @@ export function syncRuntimeSceneScheduleToClock(options: {
|
|||||||
const resolvedScheduler = resolveRuntimeProjectScheduleState({
|
const resolvedScheduler = resolveRuntimeProjectScheduleState({
|
||||||
scheduler: runtimeScene.scheduler.document,
|
scheduler: runtimeScene.scheduler.document,
|
||||||
sequences: runtimeScene.sequences,
|
sequences: runtimeScene.sequences,
|
||||||
actorIds: [...context.actorIds],
|
actorIds: context.actorIds,
|
||||||
dayNumber: clock.dayCount + 1,
|
dayNumber: clock.dayCount + 1,
|
||||||
timeOfDayHours: clock.timeOfDayHours,
|
timeOfDayHours: clock.timeOfDayHours,
|
||||||
pathsById: context.pathsById
|
pathsById: context.pathsById
|
||||||
|
|||||||
Reference in New Issue
Block a user