How ghostzragon/coffe-pack-clone works
Main Components
• Game Engine & Scene Management: Represent the Unity runtime environment—the Scenes folder and ProjectSettings. Highlight scenes such as “Grid”, “Level”, “SampleScene” that initialize the game.
• Core Gameplay Systems:
– Level Manager & Grid Manager: These are the heart of gameplay logic (located in Assets/Scripts/Core) that control level generation and grid behavior.
– Drag & Drop System & Merge System: Modules that manage user item interactions and merging of elements.
– Dynamic Difficulty: Identify the component that selects items on the fly based on game state.
– Quest/Challenge System: Under Scripts/Core/Quest.
• Game State Manager: Based on the state pattern implementation (found in Assets/Scripts/Game State) that controls overall transitions (MainMenuState, GameplayState, GameResultState, etc.)
• UI and Presentation Layer: Modules under Scripts/UI plus the prefabs for various screens (Main Menu, Gameplay UI, Level selection, Star results, etc.). Also include TextMeshPro for text rendering.
• Level Editor & Data Import: The Level Editor functionality and CSV importer for custom maps (Assets/Scripts/Ultis/CSVImport.cs) as well as related ScriptableObjects for level configurations.
• External Tools/Plugins:
– Odin Inspector (under Assets/Plugins/Sirenix) for extended editor functionality.
– TextMesh Pro for advanced UI text.
Relationships and Interactions
– Input Controllers send events to the Game State Manager.
– Game State Manager triggers core systems (Level Manager, Grid Manager) based on current state.
– Core systems update both the UI (via event calls to UI controllers) and internal game data.
– Level Editor reads CSV data and produces ScriptableObject–based level configurations that feed into Level Manager.
– The dynamic difficulty system modifies the parameters of the Level Manager and inventory/quest systems in real time.
• Feedback paths where user actions on the UI (through drag & drop) alter the grid, which in turn notifies UI components (like animations in the UI or score updates).
Architectural Patterns and Design Principles
• State Pattern: Emphasize that the game’s state transitions (for example, from Main Menu to Gameplay and then to Game Result) are encapsulated in separate state classes.
• Component-Based Design: Each game object in Unity has attached MonoBehaviours (from the various “Scripts” subfolders) that follow clear separation of concerns.
• Data-Driven Configuration: Use of ScriptableObjects and CSV files to allow easy modification of level maps, quest parameters, and UI settings.
• Separation between Presentation (UI prefabs, animations) and Core Game Logic (management scripts).
Final Advice
• Do not hesitate to split complex modules into sub-components if necessary (for instance, showing a separate flow for input handling on mobile vs. PC).