How cinn4bread/coolmathgamejam works
1. Project type and runtime
- This is a Unity 2D puzzle/physics game built with Universal Render Pipeline and packaged for at least Web/Desktop builds.
- The repo is mostly content-driven: scenes, prefabs, ScriptableObject assets, and runtime scripts under Assets/Resources.
2. High-level game structure
- The game loop is level-based: a main menu leads into a set of playable scenes (Level1–Level12, plus EvilLevel variants and supporting test/template scenes).
- Each level is a self-contained puzzle where the player builds a contraption to dispense the correct coin value and earn stars.
3. Persistent runtime layer
- A PersistentManagers prefab and Bootstrapper/DontDestroyOnLoad scripts indicate a global service layer that survives scene changes.
- This layer likely owns cross-scene systems such as audio, game state, input routing, and UI/event coordination.
4. Level and progression management
- LevelManager, Level, GameStateManager, and TargetValueManagerScript form the core progression/state boundary.
- These systems appear to manage level loading, win/lose state, target amounts, scoring/star outcomes, and transitions between menu and gameplay scenes.
5. Contraption-building system
- The game’s main mechanic is built around placeable components: rails, corners, fans, springs, seesaws, boxes, and breakable/falling variants.
- ComponentDefinition, ComponentInstance, and ComponentPlacer suggest a data-driven placement pipeline where definitions map to prefabs and instances are placed into the level grid.
6. Grid and build-space control
- GridManager and related placement scripts define the spatial rules for where the player can build.
- Supporting scripts such as CloseWalls, Windowboxer, and AutoScroll imply the playfield and camera/UI may be constrained or animated around this build space.
7. Coin and currency simulation
- Coins are a major gameplay subsystem: CoinScriptableObject defines coin data, while prefab variants exist for penny/nickel/dime/quarter/dollar.
- CoinScript, HopperScript, and DepoScript handle the physical coin flow and banking/deposit behavior that drives the educational “make exact change” mechanic.
8. Physics interaction layer
- The contraption uses Unity physics plus specialized behavior scripts such as FanPush, SpringStretch, SeesawScript, CollisionBreak, and StartLever.
- These scripts turn static placed parts into interactive mechanisms that redirect, launch, or transform coins as they move through the level.
9. UI and player-facing flow
- UI is assembled from CanvasParent, DialogueManager, HUDManagerScript, LevelSelectButton, InventoryButton, TransitionPanel, and animation helpers like MoveUpperRightPanel.
- This layer covers level select, HUD feedback, dialogue/tutorial prompts, inventory-like component selection, and scene transition animations.
10. Dialogue and scripted presentation
- Dialogue is treated as a distinct subsystem: DialogueManager, Dial, timeline assets, and signal assets (startDialogue, openDialogueBox) coordinate narrative/tutorial sequences.
- The open/close dialogue box timelines under Resources/Animations/UI indicate dialogue is presented through animated UI state changes rather than purely static panels.
11. Input and event routing
- The project uses the Unity Input System (InputSystem_Actions.inputactions) with an InputEventManager as the likely central bridge from raw player input to gameplay/UI actions.
- GameEventManager and signal assets suggest a lightweight event-bus pattern used to decouple gameplay actions, UI prompts, and state changes.
12. Audio subsystem
- AudioManager is a persistent service with MusicScript and a large set of music/SFX assets under Resources/Audio.
- The audio design is split between background music tracks and many short interaction cues tied to buttons, coins, mechanical parts, and state changes.
13. Content organization and loading model
- Most runtime assets live under Assets/Resources, which means they are intended to be loaded by name at runtime rather than only referenced directly in scenes.
- This includes prefabs for managers, UI, coins, contraption parts, and ScriptableObject definitions, making the project strongly data-driven.
14. External libraries and tooling
- The repo includes DOTween for UI/scene animation and TextMesh Pro for text rendering.
- URP and the included render/volume settings shape the visual pipeline, but the architectural focus remains on gameplay systems, scene content, and persistent managers.
15. Architecture boundary summary
- The clearest boundary is between persistent services (audio, input, state, events) and scene-local content (levels, placeable contraptions, UI panels, dialogue sequences).
- Runtime flow is: player input and UI selection → placement/state systems → physics-driven coin movement → deposit/target evaluation → HUD/audio/transition feedback.
Main entry points: Resources Resources · HUDManagerScript.cs HUD Manager · PersistentManagers.prefab Persistent Managers · LevelManager.cs Level Manager
Components 29
Persistent Services
Cross-scene managers and global runtime services.
- Bootstrapper · Starts persistent runtime objects and survives scene changes.
CoolMathGame/Assets/Resources/Scripts/Bootstrapper.cs - Persistent Managers · Prefab container for cross-scene services.
CoolMathGame/Assets/Resources/Prefabs/PersistentManagers.prefab - Audio Manager · Persistent music and SFX routing.
CoolMathGame/Assets/Resources/Scripts/AudioManager.cs - Input Bridge · Bridges Unity Input System actions into gameplay and UI events.
CoolMathGame/Assets/Resources/Scripts/InputEventManager.cs - Game Events · Lightweight decoupled signaling between systems.
CoolMathGame/Assets/Resources/Scripts/GameEventManager.cs
Gameplay Systems
Core progression, placement, physics, and coin simulation.
- State Manager · Tracks overall menu/gameplay state and transitions.
CoolMathGame/Assets/Resources/Scripts/GameStateManager.cs - Level Manager · Loads levels and coordinates progression.
CoolMathGame/Assets/Resources/Scripts/LevelManager.cs - Target Value · Controls the required coin value and success target.
CoolMathGame/Assets/Resources/Scripts/TargetValueManagerScript.cs - Grid Manager · Defines legal build space and placement bounds.
CoolMathGame/Assets/Resources/Scripts/GridManager.cs - Component Placer · Instantiates selected contraption parts into the level.
CoolMathGame/Assets/Resources/Scripts/ComponentPlacer.cs - Component Definitions · Maps placeable component data to runtime prefabs.
CoolMathGame/Assets/Resources/Scripts/ComponentDefinition.cs - Component Instances · Runtime objects representing placed contraption components.
CoolMathGame/Assets/Resources/Scripts/ComponentInstance.cs - Coin Flow · Physical coin movement, spawning, and banking behavior.
CoolMathGame/Assets/Resources/Scripts/CoinScript.cs - Hopper / Depo · Source and deposit endpoints for the coin economy.
CoolMathGame/Assets/Resources/Scripts/HopperScript.cs - Mechanisms · Interactive contraption behaviors that push, swing, stretch, or break.
CoolMathGame/Assets/Resources/Scripts/FanPush.cs
Presentation
UI, dialogue, and scene transition flows.
- HUD Manager · In-game feedback, prompts, and play screen HUD control.
CoolMathGame/Assets/Resources/Scripts/HUDManagerScript.cs - Dialogue System · Dialogue playback and timeline-driven tutorial/story presentation.
CoolMathGame/Assets/Resources/Scripts/DialogueManager.cs - Scene UI · Menu, panel motion, and scene transition animations.
CoolMathGame/Assets/Resources/Scripts/TransitionPanel.cs
Content Assets
Runtime-loaded prefabs, scriptable assets, scenes, and media.
- Scenes · Main menu and playable level scenes including evil variants.
CoolMathGame/Assets/Scenes/mainMenu.unity - Resources · Runtime-loaded prefabs, audio, animations, and scriptable assets.
CoolMathGame/Assets/Resources - UI Prefabs · Canvas, dialogue, and level selection prefabs loaded from resources.
CoolMathGame/Assets/Resources/Prefabs/UI/CanvasParent.prefab - Coin Prefabs · Coin models and value variants used by the coin simulation.
CoolMathGame/Assets/Resources/Prefabs/CoinPrefabs/Coins/BaseCoin.prefab - Mechanism Prefabs · Placeable rails, fans, springs, seesaws, and boxes.
CoolMathGame/Assets/Resources/Prefabs/CObjects/railComponent.prefab - UI Timelines · Open/close dialogue box animations used by scripted presentation.
CoolMathGame/Assets/Resources/Animations/UI/openDialogueBoxTimeline.playable - Audio Assets · Music tracks and gameplay sound effects.
CoolMathGame/Assets/Resources/Audio
Engine Stack
External packages and project-level rendering/input configuration.
- Input Actions · Unity Input System action map for gameplay and UI control.
CoolMathGame/Assets/InputSystem_Actions.inputactions - DOTween · Third-party tweening for UI and scene motion.
CoolMathGame/Assets/DOTween - URP · Universal Render Pipeline and 2D renderer project settings.
CoolMathGame/Assets/Settings/UniversalRP.asset - TextMesh Pro · Text rendering assets and shaders for UI text.
CoolMathGame/Assets/TextMesh Pro
Connections 34
- Bootstrapper → Persistent Managers: spawns · Bootstraps the persistent manager prefab.
- Persistent Managers → Audio Manager: hosts · Contains the audio service.
- Persistent Managers → Input Bridge: hosts · Contains the input bridge.
- Persistent Managers → Game Events: hosts · Contains shared event routing.
- Input Bridge → Game Events: publishes · Converts input into decoupled game events.
- Game Events → State Manager: drives · Signals state changes across systems.
- State Manager → Level Manager: orchestrates · Coordinates menu, level, and win/lose flow.
- Level Manager → Scenes: loads · Transitions into scene content.
- Level Manager → Target Value: configures · Sets level target and progression goals.
- Level Manager → HUD Manager: updates · Feeds gameplay state to HUD.
- Grid Manager → Component Placer: constrains · Defines legal placement space.
- Component Placer → Component Definitions: uses · Resolves selected component data.
- Component Placer → Component Instances: creates · Instantiates runtime placed parts.
- Component Definitions → Mechanism Prefabs: maps to · Binds component data to prefabs.
- Mechanism Prefabs → Mechanisms: contains · Prefabs are driven by interactive physics scripts.
- Mechanisms → Coin Flow: affects · Redirects, launches, or transforms coins.
- Coin Flow → Hopper / Depo: routes · Moves coins between hopper and deposit.
- Hopper / Depo → Target Value: scores · Banked coins are evaluated against the target.
- Coin Flow → Audio Manager: plays · Triggers coin and interaction sound effects.
- HUD Manager → Dialogue System: coordinates · Tutorial and prompt flow can open dialogue.
- Dialogue System → UI Timelines: animates · Uses timeline assets for opening and closing UI.
- HUD Manager → Scene UI: animates · Controls panels and scene transition UI.
- UI Prefabs → HUD Manager: hosts · Canvas and button prefabs support HUD flow.
- UI Prefabs → Dialogue System: hosts · Dialogue manager prefab provides presentation.
- Audio Assets → Audio Manager: feeds · Music and SFX are consumed by the audio service.
- Input Actions → Input Bridge: feeds · Raw action map is translated into game input.
- Resources → UI Prefabs: contains · Runtime-loaded UI content.
- Resources → Coin Prefabs: contains · Runtime-loaded coin content.
- Resources → Mechanism Prefabs: contains · Runtime-loaded contraption content.
- Resources → Audio Assets: contains · Runtime-loaded audio content.
- Resources → UI Timelines: contains · Runtime-loaded animation content.
- URP → Scenes: renders · Project scenes run under URP 2D settings.
- DOTween → Scene UI: drives · Tween library supports UI motion.
- TextMesh Pro → HUD Manager: renders text · TextMesh Pro supports HUD and dialogue text.