Update tests for scene transition sequences
This commit is contained in:
@@ -977,22 +977,32 @@ describe("RuntimeInteractionSystem", () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("shows a click prompt for enabled Scene Exits within range", () => {
|
it("shows a click prompt for interactables that run a scene transition sequence", () => {
|
||||||
const runtimeScene = createRuntimeSceneFixture();
|
const runtimeScene = createRuntimeSceneFixture();
|
||||||
runtimeScene.entities.sceneExits.push({
|
runtimeScene.sequences = {
|
||||||
entityId: "entity-scene-exit-house-door",
|
sequences: {
|
||||||
position: {
|
"sequence-enter-house": createProjectSequence({
|
||||||
x: 0,
|
id: "sequence-enter-house",
|
||||||
y: 1,
|
title: "Enter House",
|
||||||
z: 1
|
effects: [
|
||||||
},
|
{
|
||||||
radius: 2,
|
stepClass: "impulse",
|
||||||
prompt: "Enter House",
|
type: "startSceneTransition",
|
||||||
interactionEnabled: true,
|
targetSceneId: "scene-house",
|
||||||
targetSceneId: "scene-house",
|
targetEntryEntityId: "entity-scene-entry-house-front"
|
||||||
targetEntryEntityId: "entity-scene-entry-house-front"
|
}
|
||||||
});
|
]
|
||||||
runtimeScene.entities.interactables = [];
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
runtimeScene.interactionLinks = [
|
||||||
|
createRunSequenceInteractionLink({
|
||||||
|
id: "link-enter-house",
|
||||||
|
sourceEntityId: "entity-interactable-console",
|
||||||
|
trigger: "click",
|
||||||
|
sequenceId: "sequence-enter-house"
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
const interactionSystem = new RuntimeInteractionSystem();
|
const interactionSystem = new RuntimeInteractionSystem();
|
||||||
|
|
||||||
@@ -1016,45 +1026,56 @@ describe("RuntimeInteractionSystem", () => {
|
|||||||
runtimeScene
|
runtimeScene
|
||||||
)
|
)
|
||||||
).toEqual({
|
).toEqual({
|
||||||
sourceEntityId: "entity-scene-exit-house-door",
|
sourceEntityId: "entity-interactable-console",
|
||||||
prompt: "Enter House",
|
prompt: "Use Console",
|
||||||
distance: expect.any(Number),
|
distance: expect.any(Number),
|
||||||
range: 2
|
range: 2
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("dispatches scene transition requests for Scene Exit click targets", () => {
|
it("dispatches scene transition requests for interactable scene transition sequences", () => {
|
||||||
const runtimeScene = createRuntimeSceneFixture();
|
const runtimeScene = createRuntimeSceneFixture();
|
||||||
runtimeScene.entities.sceneExits.push({
|
runtimeScene.sequences = {
|
||||||
entityId: "entity-scene-exit-house-door",
|
sequences: {
|
||||||
position: {
|
"sequence-enter-house": createProjectSequence({
|
||||||
x: 0,
|
id: "sequence-enter-house",
|
||||||
y: 1,
|
title: "Enter House",
|
||||||
z: 1
|
effects: [
|
||||||
},
|
{
|
||||||
radius: 2,
|
stepClass: "impulse",
|
||||||
prompt: "Enter House",
|
type: "startSceneTransition",
|
||||||
interactionEnabled: true,
|
targetSceneId: "scene-house",
|
||||||
targetSceneId: "scene-house",
|
targetEntryEntityId: "entity-scene-entry-house-front"
|
||||||
targetEntryEntityId: "entity-scene-entry-house-front"
|
}
|
||||||
});
|
]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
runtimeScene.interactionLinks = [
|
||||||
|
createRunSequenceInteractionLink({
|
||||||
|
id: "link-enter-house",
|
||||||
|
sourceEntityId: "entity-interactable-console",
|
||||||
|
trigger: "click",
|
||||||
|
sequenceId: "sequence-enter-house"
|
||||||
|
})
|
||||||
|
];
|
||||||
const dispatches: string[] = [];
|
const dispatches: string[] = [];
|
||||||
const interactionSystem = new RuntimeInteractionSystem();
|
const interactionSystem = new RuntimeInteractionSystem();
|
||||||
|
|
||||||
interactionSystem.dispatchClickInteraction(
|
interactionSystem.dispatchClickInteraction(
|
||||||
"entity-scene-exit-house-door",
|
"entity-interactable-console",
|
||||||
runtimeScene,
|
runtimeScene,
|
||||||
{
|
{
|
||||||
teleportPlayer: () => {
|
teleportPlayer: () => {
|
||||||
throw new Error("Teleport should not dispatch for a scene exit.");
|
throw new Error("Teleport should not dispatch for a scene transition.");
|
||||||
},
|
},
|
||||||
activateSceneExit: (sceneExit) => {
|
startSceneTransition: (request) => {
|
||||||
dispatches.push(
|
dispatches.push(
|
||||||
`${sceneExit.entityId}:${sceneExit.targetSceneId}:${sceneExit.targetEntryEntityId}`
|
`${request.sourceEntityId}:${request.targetSceneId}:${request.targetEntryEntityId}`
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
toggleBrushVisibility: () => {
|
toggleBrushVisibility: () => {
|
||||||
throw new Error("Visibility should not dispatch for a scene exit.");
|
throw new Error("Visibility should not dispatch for a scene transition.");
|
||||||
},
|
},
|
||||||
playAnimation: () => {},
|
playAnimation: () => {},
|
||||||
stopAnimation: () => {},
|
stopAnimation: () => {},
|
||||||
@@ -1065,7 +1086,7 @@ describe("RuntimeInteractionSystem", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(dispatches).toEqual([
|
expect(dispatches).toEqual([
|
||||||
"entity-scene-exit-house-door:scene-house:entity-scene-entry-house-front"
|
"entity-interactable-console:scene-house:entity-scene-entry-house-front"
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user