# hunganh7204/echoes-of-the-floating-grove architecture

> Architecture diagram of the GitHub repository hunganh7204/echoes-of-the-floating-grove, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hunganh7204/echoes-of-the-floating-grove
- Repository: https://github.com/hunganh7204/echoes-of-the-floating-grove

## Overview

1. This is a Unity 2D game project, not a generic app. The runtime is built around Unity scenes, prefabs, Scriptable/asset-based content, and C# MonoBehaviours under `Assets/Game/_Scripts`. The project uses URP 2D settings (`Assets/Settings`, `Assets/UniversalRenderPipelineGlobalSettings.asset`) and TextMesh Pro for UI text.

2. The project’s main code is split from a large amount of imported content. Game-specific scripts live in `Assets/Game/_Scripts`, while art/audio/UI packs and character systems are stored under `Assets/Game/Assets` and `Assets/Game/Prefabs`. This is an important boundary: most gameplay logic is custom, but most visual content is third-party asset packs.

3. Core “service” systems sit in `Assets/Game/_Scripts/Core`: `InputManager`, `AudioManager`, `CameraFollow`, `DialogueManager`, `ScoreManager`, plus interfaces like `IDamageable`, `IInteractable`, and `IEnemyState`. These are the shared runtime dependencies other systems use to communicate without hard-coupling every object together.

4. The player is a dedicated subsystem under `Assets/Game/_Scripts/Player`. `PlayerController` is the likely top-level coordinator, with behavior split into `PlayerMovement`, `PlayerGravity`, `PlayerCombat`, `PlayerInteractor`, `PlayerStats`, and echo-related classes (`PlayerEcho`, `EchoClone`). This suggests the player is composed from multiple focused components rather than one monolithic controller.

5. Enemy behavior is implemented as a state-machine architecture in `Assets/Game/_Scripts/Enemy`. `EnemyBase` is the shared foundation, while `EnemyPatrolState`, `EnemyChaseState`, `EnemyAttackState`, and `EnemyReturnState` define ground enemy phases. A parallel flying set exists (`FlyingPatrolState`, `FlyingChaseState`, `FlyingAttackState`, `FlyingReturnState`), with concrete enemy types like `Eagle` and `Frog`.

6. World and interaction logic is separated into `Assets/Game/_Scripts/Environment`. This includes fail/finish progression (`DeadZone`, `FinishPoint`), persistence/checkpoint-style behavior (`SaveStation`), rewards (`TreasureChest`), NPC interaction (`NPCAI`), and background motion (`InfiniteParallax`). These objects are likely driven by the player’s collision/interact flow and the shared `IInteractable`/`IDamageable` contracts.

7. Level construction has its own data flow. `Assets/Game/_Scripts/Level/LevelGenerator` suggests levels are assembled procedurally or from data. The data layer under `Assets/Game/_Scripts/Data` includes `DataManager`, `LevelData`, and `PLayerData` (note the capitalization), and the repository stores JSON level definitions in `Assets/Resources/Levels/Level_1.json` and `Level_2.json`. The presence of the local `Newtonsoft.Json` package indicates JSON serialization/deserialization is part of the runtime architecture.

8. UI is a separate subsystem under `Assets/Game/_Scripts/UI`. The main screens are `MainMenuUI`, `PauseMenuUI`, `SettingUI`, `PlayerHUDUI`, `DialogueUI`, and `GameResultUI`, coordinated by `UIManager`. This implies a centralized UI controller that switches between menu, in-game HUD, dialogue, pause, settings, and end-state screens.

9. Input, audio, and scene setup are project-level infrastructure rather than gameplay logic. The repo contains Unity input action assets (`Assets/InputSystem_Actions.inputactions`, `Assets/Settings/PlayerControls.inputactions`) and an audio mixer (`Assets/Game/Audio/MainMixer.mixer`). Scenes are stored in `Assets/Scenes` and include `SampleScene.unity` and `Editor.unity`, which likely separate gameplay from editor/test workflows.

10. There is explicit editor tooling in the repo. `Assets/Game/Editor/LevelEditorManagerEditor.cs` and `Assets/Game/_Scripts/Edit/LevelEditorManager.cs` indicate custom editor support for level authoring or inspection. This is an important architectural boundary: some functionality is intended to run inside the Unity Editor only, not in player builds.

11. The project relies heavily on prefab-driven composition. Runtime prefabs such as `Player`, `Enemy`, `FlyingEnemy`, `NPC`, `FinishPoint`, `DeadZone`, `SavePointDemo`, and `TreasureDemo` are in `Assets/Game/Prefabs`. This means most in-scene gameplay objects are probably assembled in the editor from reusable components, with scripts attaching behavior and assets providing visuals.

12. There are multiple imported asset packs, but they are largely content dependencies rather than core architecture. Examples include SPUM character resources, Sunny Land environments/music, Sprout Lands UI assets, and a Tiny RPG character pack. These provide animation controllers, sprites, materials, and sample scenes, but the main game architecture remains in the custom scripts and prefabs.

13. If you’re drawing an architecture diagram, the central runtime flow is: Unity scene loads → managers initialize input/audio/UI/data → player and enemies run via component-based behaviors → environment and interactables respond through shared interfaces → level data is read from JSON/resources → UI reflects gameplay state. The strongest boundaries are between core services, player/enemy logic, environment interactions, and editor/data tooling.

Main entry points: [`Assets/Scenes/SampleScene.unity`](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Scenes/SampleScene.unity) (Scene Flow), [`Assets/Game/_Scripts/Player/PlayerController.cs`](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Player/PlayerController.cs) (Player), [`Assets/Game/_Scripts/Enemy/EnemyBase.cs`](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Enemy/EnemyBase.cs) (Enemy AI), [`Assets/Game/Prefabs/Player.prefab`](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/Prefabs/Player.prefab) (Game Prefabs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g1["Runtime"]
  node_n4["Core Services<br/>runtime services"]
  node_n5["Input Manager<br/>input service<br/>[InputManager.cs]"]
  node_n6["Audio Manager<br/>audio service<br/>[AudioManager.cs]"]
  node_n7["UI Manager<br/>ui coordinator<br/>[UIManager.cs]"]
  node_n8["Player"]
  node_n9["Enemy AI<br/>state machine<br/>[EnemyBase.cs]"]
  node_n10["Environment<br/>world objects"]
  node_n11["Level System<br/>level generation<br/>[LevelGenerator.cs]"]
end

subgraph group_g2["Content"]
  node_n14["Game Prefabs<br/>prefab set<br/>[Player.prefab]"]
  node_n15["Imported Art<br/>content packs"]
  node_n16["Imported UI<br/>ui assets"]
end

subgraph group_g3["Data"]
  node_n12["Data Models<br/>data layer<br/>[DataManager.cs]"]
  node_n13["Level JSON<br/>resources data<br/>[Level_1.json]"]
end

subgraph group_g4["Editor"]
  node_n18["Level Editor<br/>editor tooling"]
  node_n19["Editor Runtime<br/>editor-only code"]
end

subgraph group_g5["Project"]
  node_n1["Scene Flow<br/>Unity scenes<br/>[SampleScene.unity]"]
  node_n2["URP 2D<br/>render pipeline"]
  node_n3["Input Assets<br/>input config"]
  node_n17["TextMesh Pro<br/>ui text<br/>[TMP Settings.asset]"]
  node_n20["Audio Mixer<br/>mixer asset<br/>[MainMixer.mixer]"]
end

node_n1 -->|"initializes"| node_n4
node_n1 -->|"spawns"| node_n8
node_n1 -->|"spawns"| node_n9
node_n1 -->|"hosts"| node_n10
node_n1 -->|"loads level"| node_n11
node_n2 -->|"renders"| node_n1
node_n3 -->|"feeds"| node_n5
node_n5 -->|"controls"| node_n8
node_n5 -.->|"steers"| node_n9
node_n6 -->|"uses"| node_n20
node_n7 -->|"uses"| node_n17
node_n8 -->|"depends on"| node_n4
node_n8 -->|"interacts"| node_n10
node_n9 -->|"depends on"| node_n4
node_n9 -->|"targets"| node_n8
node_n10 -->|"uses contracts"| node_n4
node_n11 -->|"reads data"| node_n12
node_n12 -->|"deserializes"| node_n13
node_n18 -->|"extends"| node_n19
node_n18 -.->|"authoring"| node_n11
node_n14 -->|"assembles"| node_n8
node_n14 -->|"assembles"| node_n9
node_n14 -->|"assembles"| node_n10
node_n15 -->|"supplies visuals"| node_n14
node_n16 -->|"supplies ui"| node_n7
node_n11 -->|"builds"| node_n1

click node_n1 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Scenes/SampleScene.unity"
click node_n2 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/UniversalRenderPipelineGlobalSettings.asset"
click node_n3 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Settings/PlayerControls.inputactions"
click node_n4 "https://github.com/hunganh7204/echoes-of-the-floating-grove/tree/main/Assets/Game/_Scripts/Core"
click node_n5 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Core/InputManager.cs"
click node_n6 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Core/AudioManager.cs"
click node_n7 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/UI/UIManager.cs"
click node_n8 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Player/PlayerController.cs"
click node_n9 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Enemy/EnemyBase.cs"
click node_n10 "https://github.com/hunganh7204/echoes-of-the-floating-grove/tree/main/Assets/Game/_Scripts/Environment"
click node_n11 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Level/LevelGenerator.cs"
click node_n12 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Data/DataManager.cs"
click node_n13 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Resources/Levels/Level_1.json"
click node_n14 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/Prefabs/Player.prefab"
click node_n15 "https://github.com/hunganh7204/echoes-of-the-floating-grove/tree/main/Assets/Game/Assets/Sunny-land-files"
click node_n16 "https://github.com/hunganh7204/echoes-of-the-floating-grove/tree/main/Assets/Game/Assets/Sprout Lands - UI Pack - Basic pack"
click node_n17 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/TextMesh Pro/Resources/TMP Settings.asset"
click node_n18 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/Editor/LevelEditorManagerEditor.cs"
click node_n19 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Edit/LevelEditorManager.cs"
click node_n20 "https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/Audio/MainMixer.mixer"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_n4,node_n5,node_n6,node_n7,node_n8,node_n9,node_n10,node_n11 toneBlue
class node_n14,node_n15,node_n16 toneAmber
class node_n12,node_n13 toneMint
class node_n18,node_n19 toneRose
class node_n1,node_n2,node_n3,node_n17,node_n20 toneIndigo
```

## Components

### Runtime

Core gameplay systems that run in scenes and prefabs.

- [Core Services](https://github.com/hunganh7204/echoes-of-the-floating-grove/tree/main/Assets/Game/_Scripts/Core): runtime services · Shared managers and contracts used across gameplay systems. · `Assets/Game/_Scripts/Core`
- [Input Manager](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Core/InputManager.cs): input service · Central input handling and gameplay control entry point. · `Assets/Game/_Scripts/Core/InputManager.cs`
- [Audio Manager](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Core/AudioManager.cs): audio service · Global audio playback and mixer-facing runtime coordination. · `Assets/Game/_Scripts/Core/AudioManager.cs`
- [UI Manager](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/UI/UIManager.cs): ui coordinator · Switches between menus, HUD, dialogue, pause, settings, and result screens. · `Assets/Game/_Scripts/UI/UIManager.cs`
- [Player](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Player/PlayerController.cs): player subsystem · Component-based player runtime with movement, combat, interaction, stats, and echo behavior. · `Assets/Game/_Scripts/Player/PlayerController.cs`
- [Enemy AI](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Enemy/EnemyBase.cs): state machine · Ground and flying enemy behavior built from shared base logic and state objects. · `Assets/Game/_Scripts/Enemy/EnemyBase.cs`
- [Environment](https://github.com/hunganh7204/echoes-of-the-floating-grove/tree/main/Assets/Game/_Scripts/Environment): world objects · Interactive world objects, progression triggers, save points, and background motion. · `Assets/Game/_Scripts/Environment`
- [Level System](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Level/LevelGenerator.cs): level generation · Level assembly and runtime generation from authored data. · `Assets/Game/_Scripts/Level/LevelGenerator.cs`

### Content

Imported art, audio, and reusable prefab content.

- [Game Prefabs](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/Prefabs/Player.prefab): prefab set · Prefab-driven runtime assemblies for player, enemies, NPCs, hazards, and checkpoints. · `Assets/Game/Prefabs/Player.prefab`
- [Imported Art](https://github.com/hunganh7204/echoes-of-the-floating-grove/tree/main/Assets/Game/Assets/Sunny-land-files): content packs · Third-party sprite, animation, and character asset packs supporting the game. · `Assets/Game/Assets/Sunny-land-files`
- [Imported UI](https://github.com/hunganh7204/echoes-of-the-floating-grove/tree/HEAD/Assets/Game/Assets/Sprout%20Lands%20-%20UI%20Pack%20-%20Basic%20pack): ui assets · External UI sprite sheets and fonts used by in-game screens and menus. · `Assets/Game/Assets/Sprout Lands - UI Pack - Basic pack`

### Data

Level definitions and JSON-backed runtime data.

- [Data Models](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Data/DataManager.cs): data layer · Runtime data objects and manager for level and player state. · `Assets/Game/_Scripts/Data/DataManager.cs`
- [Level JSON](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Resources/Levels/Level_1.json): resources data · JSON level definitions loaded through Unity Resources. · `Assets/Resources/Levels/Level_1.json`

### Editor

Unity editor-only authoring tools.

- [Level Editor](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/Editor/LevelEditorManagerEditor.cs): editor tooling · Custom Unity editor support for inspecting or authoring levels. · `Assets/Game/Editor/LevelEditorManagerEditor.cs`
- [Editor Runtime](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/_Scripts/Edit/LevelEditorManager.cs): editor-only code · Editor-facing level management logic separated from player builds. · `Assets/Game/_Scripts/Edit/LevelEditorManager.cs`

### Project

Scene, render, input, and package-level configuration.

- [Scene Flow](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Scenes/SampleScene.unity): Unity scenes · Entry scenes and scene-level composition for gameplay and editor workflows. · `Assets/Scenes/SampleScene.unity`
- [URP 2D](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/UniversalRenderPipelineGlobalSettings.asset): render pipeline · 2D rendering setup and project-wide render settings. · `Assets/UniversalRenderPipelineGlobalSettings.asset`
- [Input Assets](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Settings/PlayerControls.inputactions): input config · Unity input action assets used by gameplay and controls. · `Assets/Settings/PlayerControls.inputactions`
- [TextMesh Pro](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/HEAD/Assets/TextMesh%20Pro/Resources/TMP%20Settings.asset): ui text · Text rendering package assets and shaders used by the UI layer. · `Assets/TextMesh Pro/Resources/TMP Settings.asset`
- [Audio Mixer](https://github.com/hunganh7204/echoes-of-the-floating-grove/blob/main/Assets/Game/Audio/MainMixer.mixer): mixer asset · Project-wide audio mix configuration used by the audio service. · `Assets/Game/Audio/MainMixer.mixer`

## Connections

- Scene Flow → Core Services: initializes · Scene startup brings core runtime services online.
- Scene Flow → Player: spawns · Gameplay scenes instantiate the player prefab and controller stack.
- Scene Flow → Enemy AI: spawns · Scenes place enemy prefabs and AI state machines into the world.
- Scene Flow → Environment: hosts · Scene composition contains interactive environment objects.
- Scene Flow → Level System: loads level · Scene flow relies on level generation to build playable content.
- URP 2D → Scene Flow: renders · URP 2D settings drive how scenes are rendered.
- Input Assets → Input Manager: feeds · Input action assets are consumed by the input manager.
- Input Manager → Player: controls · Player movement and combat are driven through shared input.
- Input Manager → Enemy AI: steers · Enemy behaviors can react to player input indirectly through world state.
- Audio Manager → Audio Mixer: uses · Audio manager routes playback through the main mixer.
- UI Manager → TextMesh Pro: uses · UI screens render text through TextMesh Pro assets.
- Player → Core Services: depends on · Player components use shared services and interfaces.
- Player → Environment: interacts · Player collision and interaction drive world object behavior.
- Enemy AI → Core Services: depends on · Enemy state logic shares damage and interaction contracts.
- Enemy AI → Player: targets · Enemies chase and attack the player subsystem.
- Environment → Core Services: uses contracts · Environment objects rely on shared interactable and damageable interfaces.
- Level System → Data Models: reads data · Level generation consumes structured runtime data.
- Data Models → Level JSON: deserializes · Data manager loads level definitions from JSON resources.
- Level Editor → Editor Runtime: extends · Custom editor tooling operates on the editor-only level manager.
- Level Editor → Level System: authoring · Editor support is used to inspect or build generated levels.
- Game Prefabs → Player: assembles · Player prefab combines the player controller and supporting components.
- Game Prefabs → Enemy AI: assembles · Enemy and flying enemy prefabs package AI behaviors and visuals.
- Game Prefabs → Environment: assembles · Environment prefabs package hazards, checkpoints, rewards, and NPCs.
- Imported Art → Game Prefabs: supplies visuals · Imported character and environment packs provide art and animation content for prefabs.
- Imported UI → UI Manager: supplies ui · UI asset packs provide sprites and fonts for menus and HUD.
- Level System → Scene Flow: builds · Generated or data-driven levels are instantiated within scenes.
