# sunshine-724/escape-game architecture

> Architecture diagram of the GitHub repository sunshine-724/escape-game, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sunshine-724/escape-game
- Repository: https://github.com/sunshine-724/escape-game

## Overview

##### Main Components
- Game Engine Core: Represent the Unity engine as the foundation.
- Scenes: Show the different scenes (e.g., Title, Demo, GameScenes, Ending, etc.) available in the Assets/Scenes folder (and additional scenes under “Classic Legacy Pack - Village/Scenes” and “Pixel Adventure 1/Scenes” if they relate to levels or environments).
- Game Managers & Event Systems: Highlight central scripts such as GameManager (in Scripts/Event/GameManager.cs), Event managers for handling in-game events, and Event scripts for different event sequences.
- Player and Characters: Include components for the Player (Assets/Scripts/Player) and enemy or NPC elements within Scripts/Enemy.
- Environmental Elements and Prefabs: Organize various Prefabs (e.g., for doors, teleports, stairs, background elements) placed in Assets/Prefab and Assets/Scenes. Include the objects and art assets (Images, Animation, Materials).
- Asset Management: Show the role of art (Images, Animation, Material), audio (Sound, BGM), and the prefabricated components (Prefabs) that are loaded into scenes.
- External Services: Although this is a self-contained Unity project, include the Unity packages and settings (Packages, ProjectSettings) as supporting infrastructure.

- That the Unity engine loads Scenes that are built using multiple Prefabs and assets.
- Directional flows: for example, the GameManager drives the flow between scenes and triggers events; Event Managers (and their multiple event scripts) interface with interactive objects (doors, teleporters, etc.); player input gets processed by the Player component and may invoke animations, sound effects, or triggers in environmental scripts.
- Prefabs (from Assets/Prefab) with their respective assets in Animation, Images, and Sound directories.

##### Architectural Patterns
- Unity Component-Based Architecture: Emphasize that most in-game behavior is defined by attaching multiple scripts (components) to GameObjects (prefabs). You might note this as “Component-Entity” or “GameObject-based” design.
- Layered Organization: Differentiate between the Core Game Logic (scripts, scene management, event handling) and the visual/audio presentation (animations, art assets, audio).

## Diagram (Mermaid)

```mermaid
graph TD
    U["Unity Engine"]:::engine
    GEC["Game Engine Core"]:::infra
    U --> GEC

    subgraph "Scenes"
        S1["Main Scenes"]:::scene
        S2["Classic Legacy Pack Scenes"]:::scene
        S3["Pixel Adventure 1 Scenes"]:::scene
    end
    GEC --> S1
    GEC --> S2
    GEC --> S3

    subgraph "Game Managers & Event Systems"
        GM_Script["GameManager (Script)"]:::logic
        GM_Prefab["GameManager (Prefab)"]:::logic
        EM["Other Event Scripts"]:::logic
    end
    S1 --> GM_Script
    S1 --> GM_Prefab
    S2 --> GM_Script
    S3 --> GM_Script

    subgraph "Player and Characters"
        P_Scripts["Player Scripts"]:::logic
        P_Prefab["Player Prefab"]:::logic
        Character_Image["Character Images"]:::asset
        PixelCharacters["Pixel Adventure Characters"]:::asset
    end
    GM_Script --> P_Scripts
    GM_Prefab --> P_Scripts
    EM --> P_Scripts

    subgraph "Environmental Elements and Prefabs"
        Env_Prefabs["Environment Prefabs"]:::logic
        Objects_Images["Objects Images"]:::asset
    end
    P_Scripts --> Env_Prefabs
    Env_Prefabs --> Objects_Images

    subgraph "Asset Management (Visual & Audio Assets)"
        Animations["Animations"]:::asset
        Images["Images"]:::asset
        Materials["Materials"]:::asset
        Sounds["Sounds"]:::asset
    end
    Objects_Images --> Animations
    Objects_Images --> Images
    Objects_Images --> Materials
    Objects_Images --> Sounds

    %% Click Events
    click GEC "https://github.com/sunshine-724/escape-game/tree/main/Packages / ProjectSettings"
    click S1 "https://github.com/sunshine-724/escape-game/tree/main/Assets/Scenes"
    click S2 "https://github.com/sunshine-724/escape-game/tree/main/Assets/Classic Legacy Pack - Village/Scenes"
    click S3 "https://github.com/sunshine-724/escape-game/tree/main/Assets/Pixel Adventure 1/Scenes"
    click GM_Script "https://github.com/sunshine-724/escape-game/blob/main/Assets/Scripts/Event/GameManager.cs"
    click GM_Prefab "https://github.com/sunshine-724/escape-game/blob/main/Assets/Prefab/EventManager/GameManager.prefab"
    click EM "https://github.com/sunshine-724/escape-game/tree/main/Assets/Scripts/Event"
    click P_Scripts "https://github.com/sunshine-724/escape-game/tree/main/Assets/Scripts/Player"
    click P_Prefab "https://github.com/sunshine-724/escape-game/blob/main/Assets/Prefab/Player.prefab"
    click Character_Image "https://github.com/sunshine-724/escape-game/tree/main/Assets/Image/Character"
    click PixelCharacters "https://github.com/sunshine-724/escape-game/tree/main/Assets/Pixel Adventure 1/Assets/Main Characters"
    click Env_Prefabs "https://github.com/sunshine-724/escape-game/tree/main/Assets/Prefab"
    click Objects_Images "https://github.com/sunshine-724/escape-game/tree/main/Assets/Image/Objects"
    click Animations "https://github.com/sunshine-724/escape-game/tree/main/Assets/Animation"
    click Images "https://github.com/sunshine-724/escape-game/tree/main/Assets/Image"
    click Materials "https://github.com/sunshine-724/escape-game/tree/main/Assets/Material"
    click Sounds "https://github.com/sunshine-724/escape-game/tree/main/Assets/Sound"

    %% Styles
    classDef engine fill:#f9c74f,stroke:#000,stroke-width:2px;
    classDef infra fill:#90be6d,stroke:#000,stroke-width:2px;
    classDef scene fill:#f9844a,stroke:#000,stroke-width:2px;
    classDef logic fill:#577590,stroke:#000,stroke-width:2px;
    classDef asset fill:#43aa8b,stroke:#000,stroke-width:2px;
```
