How bluetortoise66/cookieman works
Project type and purpose
• From the file tree and minimal README, this is a Unity-based 2D grid/tile‐based game or prototype called “CookieMan.”
• It uses Unity’s Input System, custom grid management code, and Unity RuleTile assets (Path, Wall) to render a tile map in a test scene.
File structure
• Top‐level “Assets” directory holds all game content:
• Scenes/TestScene.unity
• Script/ – runtime C# scripts, subdivided into Grid and Ruletile
• Script/Grid/Editor – custom inspector/editor extensions (GridManagerEditor.cs)
• Tileset/ – Prefabs and RuleTile asset definitions
• InputSystem_Actions.inputactions – input mapping
• Sprites – probably spritesheet assets (empty in tree)
• Packages/manifest.json & lock: Unity Package Manager, includes Input System, possibly 2D Tilemap packages.
• ProjectSettings: Unity project configuration (physics, navmesh, graphics, etc.).
README
• No further architectural notes beyond project title. All inferences come from code and asset layout.
a. Main components
• Unity Engine Core (runtime host)
• Editor Extensions (GridManagerEditor)
• Input System (mapped actions)
• Grid Subsystem
– GameGrid (data model)
– GridObject (per‐cell state)
– GridManager (manager/orchestrator)
– GridRenderer (draws tiles based on RuleTile assets)
• RuleTile Assets
– Path Ruletile.asset + Wall Ruletile.asset
– Path.cs, Wall.cs (custom behavior)
• Scene & Prefabs
– TestScene.unity loads Prefab BaseMap & attaches GridManager, GridRenderer
• Unity Package Manager & ProjectSettings (configuration layer)
b. Relationships and interactions
• At Edit time: Editor Extensions → configure GridManager settings in Inspector
• At Play time: Player Input → Input System → GridManager triggers updates
• GridManager ↔ GameGrid (reads/writes grid data)
• GameGrid → instantiates/updates GridObject instances
• GridRenderer polls GameGrid & RuleTile assets to render sprites in the Scene
• RuleTile scripts (Path.cs/Wall.cs) define tile‐specific placement logic
• TestScene connects all components; Prefab BaseMap holds default grid layout
c. Architectural patterns and design principles
• MVC‐like separation:
– Model: GameGrid & GridObject
– View: GridRenderer + Unity Tilemap/Renderer
– Controller: GridManager + Input System
• Editor‐tooling for configuration: GridManagerEditor separates edit‐time from runtime.
• Asset‐driven design: RuleTile assets define map logic without code changes.
d. Key technologies and frameworks
• Unity 2020+ (2D Tilemap, ScriptableObjects for RuleTiles)
• Unity Input System (Assets/InputSystem_Actions.inputactions)
• C# custom Editor scripts
• Unity Package Manager for dependency management