-- Figure out the next scene to load when one finishes.

EventSequencer.onOrchestrationFinished:Connect(function(endedSceneName)	
	if endedSceneName == PSV_SCENE.Name then
		-- PreShowVenue just ended. Now load the first scene in the show.
		local scene1 = SHOW_SCENES[1]
		if scene1 then
			EventSequencer.loadScene(scene1.Name)
		else
			warn("There are no scenes in the show list to load.")
			loadPreShowVenue()
		end
	else
		-- Find the ended-scene in the show list so that we know what to load next.
		for i,scene in ipairs(SHOW_SCENES) do
			if scene.Name == endedSceneName then
				if i < #SHOW_SCENES then
					-- Load the next scene.
					EventSequencer.loadScene(SHOW_SCENES[i+1].Name)
				else
					-- Last scene in the show ended. Load the PreShowVenue.
					loadPreShowVenue()
				end
			end
		end
	end
end)

