I’m working on a system to drive a top down camera around a level I am setting up. The game is mostly on rails, with auto scrolling segments composing the majority of the game. But some rooms, especially bonus rooms, or rooms that allow for free movement need to be supported. I need to be able to adjust behavior in the inspector, and I should be able to handle branching paths when the time comes.
I have a nearly working solution, but I can’t serialize a reference to a class inside of itself. That was important for making one of the camera modes work as I had envisioned it (the wait for player to walk to edge of screen before continuing to another state state specifically). So it doesn’t work without some restructuring. And I’m a bit stumped.
So I’m calling on the forums to help me think through the problem. What would your general solution to this problem look like? And how would you define camera behavior at each point, such that it can be efficiently edited in the inspector? Some fresh perspective ought to help me quit overthinking it.
The level I’m building right now looks like this:
-
Start at p0.
-
Prompt player to Go->, begin scrolling when they do.
-
Scroll to p1.
-
Wait for player to destroy barrier.
-
Prompt player to Go->, resume scrolling when they do.
-
Quick transition scroll to p2.
-
Slight delay.
-
Scroll to p3.
-
Wait for defined set of enemies to be killed
-
Prompt player to Go->, resume scrolling when they do.
-
…
Anywhere within this sequence, the player could find a secret and branch to a room where the camera follows them, but is constrained to stay inside of a box.