GAME 1303 — Tier 6: Narrative, Interaction & Light
Fourteen scripts. This tier unblocks Anabasis (Andraya) and Detective Liz (Mena), and gives Commission Witch her multiple endings.
Builds on Tier 1 (AudioManager, SceneLoader, Health), Tier 2 (Hitbox, EnemyChase, FloatingEnemy), Tier 3 (FuelSystem for the battery, Health v1.1), Tier 4 (ChoiceFlagManager — the backbone), and Tier 5 (TopDownMover). Nothing from earlier tiers changes.
Scripts/
Interaction/ Interactable, InteractionPrompt, ClueJournal
Dialogue/ DialogueData (ScriptableObject), DialogueRunner, DialogueTrigger
Endings/ EndingSelector, WorldStateSwapper
Light/ Flashlight2D, DarknessMeter, SafeLightZone, LightSensitiveEnemy
Puzzle/ PushBlock, FloorTransition
The one idea holding this tier together
Everything reads and writes flags through Tier 4's ChoiceFlagManager. A dialogue line sets met_the_ghost; a door requires it; a WorldStateSwapper state repaints the room when it's set; an EndingSelector checks it at the end. Because they all share one memory, students never wire narrative systems to each other directly — they just agree on flag names. Worth ten minutes in class: name your flags before you build anything, lowercase with underscores, and keep a list on the whiteboard.
HasAll("found_key, !alarm_tripped") handles compound conditions with negation, and it's the same syntax in every Require Flags field across the tier.
Interaction
Interactable (trigger + prompt text + OnInteract UnityEvent) is the most reusable script in the whole kit — nearly every "something happens when the player does a thing here" moment is one of these plus an event. InteractionPrompt goes on the player, one for the entire game: it tracks what's in range, shows a floating "[E] Examine" over the closest one, and routes the key press. It also forwards the key to DialogueRunner when a conversation is open, so the same button talks and advances.
ClueJournal is Detective Liz's case notes: discovering a clue sets clue_<id> as a flag, so dialogue options can appear only after the player has found the relevant evidence. The "4 / 9 clues" readout is what makes an investigation feel like progress.
Dialogue
DialogueData is a ScriptableObject: a list of lines, each with a speaker, portrait, optional flag requirement, optional flag to set, and optional choices. Branching is just a choice with a goToLine index. DialogueRunner plays it with a typewriter effect, spawns choice buttons, and freezes the player.
Two details students will notice immediately if they're missing: pressing the key mid-typewriter shows the whole line at once, and a line whose Require Flags fail is skipped silently — which is the cheapest possible way to have a character react to what happened earlier.
Tell students to write conversations on paper with numbered lines first. Branching dialogue is much easier to type into the Inspector than to invent there.
DialogueTrigger is for conversations the game imposes (walk into a room, opening narration); an Interactable is for conversations the player chooses.
Endings
EndingSelector holds a list of outcomes, each with conditions — flags, an item count from the CollectionTracker, or a ChoiceFlagManager counter. First match wins, so the hardest ending goes at the top and the fallback goes last. Sylvia's "different endings based on how many ingredients you collect" is three entries with different minItemCount values. Every ending seen sets ending_seen_<id>, so Andraya's ENDING LIST menu is just a set of flag checks.
WorldStateSwapper is Jax's class note on Anabasis made literal — "the imagery of the world changes to fit the choices you made." Each state has flag conditions plus sprite swaps, colour tints (which fade), and objects to show or hide. Last match wins, so states stack from base to most-transformed.
Light — Detective Liz's whole game
This needs URP with 2D lighting: a Global Light 2D set dark (~0.15) is what makes the building dark in the first place.
Flashlight2D— aims by mouse, facing, or stick; drains a Tier 3FuelSystembattery; recharges only while standing still (Jax's idea), which is the design centrepiece; flickers when low; and carries a Tier 2Hitboxon the beam so it can hurt ghosts.DarknessMeter— fills in the dark, drains in light, damages the player when full, with a grace period so passing through a shadow is free.SafeLightZone— lamps and lit rooms that hold the dread off, switchable off by story events, with an optional failing-bulb flicker.LightSensitiveEnemy— ghosts that flee, freeze, weaken, or burn in the beam. This is separate from the beam's Hitbox on purpose: the interesting part isn't damage, it's that the ghost behaves differently in light, which makes the flashlight feel like a tool rather than a gun.
The combination worth pointing out to Mena: recharging requires standing still, and standing still in the dark fills the dread meter. That's a real dilemma, and it's the game.
Traversal & puzzles
PushBlock in Physics mode (walk into it, it slides) or Grid mode (sokoban-precise). Wire RespawnManager.OnRespawned → PushBlock.ResetPosition — students forget this and then wonder why testers get permanently stuck.
FloorTransition moves the player between floors within one scene, which is the right call for Liz's five-story building: five scenes would mean five copies of the player, HUD, flashlight state and ghosts, whereas one scene keeps the battery, dread and clue flags alive automatically. Two-way stairs are two of these pointing at each other. It swaps a Cinemachine confiner by reflection, so the script still compiles for a student who hasn't installed Cinemachine.
Input actions to add
| Action | Type | Bindings | Used by |
|---|---|---|---|
Interact | Button | E, gamepad South/A | InteractionPrompt (and dialogue advance) |
Flashlight | Button | F, gamepad West/X | Flashlight2D |
AudioManager names referenced
flashlight_click, flashlight_empty, clue_found, push, stairs, door_locked.
Per-game recipes
- Anabasis (Andraya) —
Interactable+DialogueRunner+DialogueDatafor memories,ChoiceFlagManagerrecording decisions,WorldStateSwappertransforming the world as she remembers,PushBlock+ Tier 4PuzzleSwitchfor puzzles,EndingSelectorfor the truth. - Detective Liz (Mena) — the whole
Light/folder +ClueJournal+FloorTransition+DialogueRunner. Ghosts are Tier 2FloatingEnemy+EnemyChase+LightSensitiveEnemy. - Commission Witch (Sylvia) —
Interactableorder board →DialogueRunner;EndingSelectorwith three ingredient thresholds. - MythoClash / Zap Attack —
DialogueTriggerfor intros and hub NPCs. - Cozy Critters / Store Sim —
Interactablefor care actions and shelves.
Notes for the instructor
DialogueRunnerusesWaitForSecondsRealtimein the typewriter so conversations still type whileTime.timeScaleis 0 — that matters if a student pauses the game during dialogue.- Choice jumps use an explicit
pendingJumprather than rewinding the index, so a line with both agoToLineand choices can't double-jump. FindFirstObjectByType(DialogueTrigger) is Unity 2023+/6; on 2022 change toFindObjectOfType.Flashlight2D.IsLit()is a simple cone test, deliberately independent of the Light 2D's actual shape — students should matchconeAngle/rangeroughly to their light and tune by feel, not by measuring.- Same caveat: hand-reviewed, not compiled here. This tier has the most UI wiring of any so far, so budget a full class session for the dialogue panel setup.