This is the game scene players enter when they first start a game. It plays a short intro cutscene that shows the player character waking up and then hand control over to them. Over the course of the stage players climb a cliff to collect a sword and shield. The sword then lets them cut through some vines that block the path to the next stage. A heart shard is hidden in an optional little cave that is also blocked by vines.

Entry

When the scene is loaded a couple different things can happen. This is configured in the ScriptMachine in the Entry object. It checks if the intro has already been played using the Beach_Intro persisted bool. If it has not it starts the TimelineAction in Intro. Otherwise it checks the string persisted under Parameter. If a “1” is found it starts the HeroEnter subgraph that moves the player in through the trunk leading to the inland scene. Otherwise it starts the HeroWake TimelineAction which quickly fades the screen in from black. This usually happens if the player has died.

Environment

All the environments in the hero demo were made using ProBuilder. They use the same HeroDefault material as all the object and character models that were made externally using blender. To assign colors to individual surfaces the UVs of those surface have been collapsed together and moved to the wanted color in the ProBuilder UV Editor.

Cliff

This part of the environment has been split into its own mesh. The gameobject has a MeshCollider and GenericTriggerItem so it can be detected by the GenericTriggerArea of the HeroClimbAction located in the player actor inside the HeroSetup prefab. The collider has some depth resulting in a semi pyramid kind of shape as flat surfaces result in some problems with how climbing works.

Chest

Chests in the hero demo use the custom HeroChestAction which extends the common TimelineAction. When it is started it moves the character to an exact spot in front of the chest defined in the ObjectCharacterTarget and when it ends it adds items to the character as defined in the Items field.

It also saves whether it has already been opened to the Persister. When the game starts and that persister is already set it moves the chest Animator to its Opened state and destroys itself so it can’t be used again.

It can be annoying to get both the chest and player model into place to test out the timeline in a regular scene. The HeroDebuggingInteraction scene contains a non-playable version of the player chest interaction that makes this easier.

Ambience

The Forrest transform contains an AudioSource with a looping track that contains some tweeting birds and general forest ambience. Its position and spacial parameters are set up so that the player only hears them as they get closer to the inland caves and so they increase in volume as they move into them.

In the opposite direction out in the water there are five different transforms(WaveA-E) for waves sounds. These are controlled by the ScriptMachine found in Waves. The machine waits for a random duration between 1 and 5 seconds and then chooses one of the waves, varies its pitch, plays it and repeats.

Destructibles

Both the HeroVines and HeroSeaUrchins have colliders and a DestructibleDamageReceiver which replaces them with their DestroyedPrefab when hit by any kind of damage.

The HeroVinesDestroyed prefab simply contains a sound and some particles which all play automatically when it is spawned. It gets destroyed after two seconds by its FadeAndDestroy script.

HeroSeaUrchinPickup also contains a HeroHeartPickup which uses a HeroPickupArea to give a HeroHeart usable to any character that enters its area. The pickup sits under an Animator which performs a little growing and floating animation. The entire object starts to blink after 10 seconds and then blinks for 3 before being destroyed as defined in the FadeAndDestroy script in its root.

Trunk

The HeroExitTrunk found here is used to transition the player to the HeroInland scene.

The ScriptMachine in its root defines how it behaves. When the player enters its area it sets the game state to CUTSCENE, starts the Exit TimelineAction and transitions the sound to the Muted snapshots. When that action is done it sets Scene and Parameter to whatever is defined in the variables. In this case the Scene is HeroInland and Parameter is 1 so the inland scene knows which entry the player is coming from. Finally it Saves the game and Loads the next scene.

In addition to the Exit action it also contains an Enter action which is triggered by the Entry if Parameter is 1 meaning the player enters the beach coming from the inland trunk.

An isolated version of this behaviour with visible marching points and collision areas can be found in HeroDebuggingLoading.