# vinny-nguyen/uwaft-cav-game architecture

> Architecture diagram of the GitHub repository vinny-nguyen/uwaft-cav-game, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vinny-nguyen/uwaft-cav-game
- Repository: https://github.com/vinny-nguyen/uwaft-cav-game

## Overview

##### Main Components
- Unity Engine & Core Framework: At the center, denote the Unity engine as the runtime platform. Include essential Unity mechanisms such as the game loop and rendering engine.
- Scripts and Game Logic: Create a component for “GameScripts” that encapsulates various C# scripts. Highlight key pieces like:
- GameManager.cs (central game state control and orchestration)
- Input Management (Assets/InputSystem_Actions.inputactions, and possibly scripts handling player input)
- Car and Environment Control (DriveCar.cs, SwapCar.cs, EnvironmentGenerator.cs)
- UI & NodeMap functionality (PopupManager.cs, NodeMap subfolder scripts such as PopupManager.cs, CarManager.cs, FadeManager.cs, etc.)
- Other supporting scripts (CameraController, CollectFuel, FuelController, etc.)
- Assets: A block for Assets that includes:
- Graphics, Sprites, and TextMesh Pro resources which support the visual components.
- Audio, particle effects, and additional visual assets used by scenes and scripts.
- External Tools/Dependencies: Optionally, denote the following:
- Unity Hub (for project management and scene loading)
- .NET SDK (for script compilation and editing in Visual Studio Code)
- Git as a version control mechanism (referenced in the README instructions).

##### Relationships and Interactions
- That the Input System communicates directly with game logic scripts (e.g., from InputSystem_Actions to player control scripts).
- That asset data (cars, nodes, popups) is consumed by various game scripts and scenes during runtime.
- Link ProjectSettings as a foundational configuration that impacts how assets and scenes are rendered and behave.

##### Architectural Patterns and Design Principles
- Component-Based Design: Emphasize that the project employs Unity’s core paradigm where game objects are composed of multiple components (scripts, colliders, renderers, etc.). This can be denoted with a note or symbol.
- Separation of Concerns: Different categories such as user interface (menus, popups), core game logic (GameManager, environment handling), and resource management (assets, scenes) should be clearly delineated.
- Event-Driven Flow: Indicate how events (such as player inputs and game state changes) trigger transitions between scenes and invoke game logic scripts.

- Branch out to the “Scenes” layer, with each scene (MainMenu, Loading Screen, DrivingScene, NodeMap, Settings Menu) as individual nodes. Label them with their respective names.
- “Game Scripts” to “Scenes” (indicating script invocation/scene management) and also link “Assets” to both “Scenes” and “Game Scripts” (indicating asset utilization).
- A “Project Settings” block that underpins the overall system configuration, connected to Unity Engine and relevant components.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Unity Engine
    U("Unity Engine"):::unity

    %% Scenes
    subgraph "Scenes"
        mainMenu("MainMenu"):::scene
        loading("Loading Screen"):::scene
        driving("DrivingScene"):::scene
        nodeMap("NodeMap"):::scene
        settings("Settings Menu"):::scene
    end

    %% Game Scripts
    subgraph "Game Scripts"
        gm("GameManager"):::script
        inputM("Input Management"):::script
        subgraph "Car & Environment Control"
            drive("DriveCar"):::script
            env("EnvironmentGenerator"):::script
            swap("SwapCar"):::script
        end
        subgraph "UI & NodeMap Functionality"
            popups("UI Popups"):::script
            nodeScripts("NodeMap Scripts"):::script
        end
        subgraph "Other Supporting Scripts"
            cam("CameraController"):::script
            fuelCollect("CollectFuel"):::script
            fuelCtrl("FuelController"):::script
        end
    end

    %% Assets
    subgraph "Assets"
        assets("Assets"):::assets
    end

    %% Project Settings
    subgraph "Project Settings"
        projSet("ProjectSettings"):::config
    end

    %% External Tools/Dependencies
    subgraph "External Tools/Dependencies"
        hub("Unity Hub"):::external
        dotnet(".NET SDK"):::external
        git("Git"):::external
    end

    %% Connections from Unity Engine to Scenes
    U -->|"orchestrates"| mainMenu
    U -->|"orchestrates"| loading
    U -->|"orchestrates"| driving
    U -->|"orchestrates"| nodeMap
    U -->|"orchestrates"| settings

    %% GameManager controlling scene transitions
    gm -->|"controls"| mainMenu
    gm -->|"controls"| driving
    gm -->|"controls"| nodeMap
    gm -->|"controls"| settings

    %% Input system integration
    inputM -->|"feeds"| gm

    %% Car & Environment Control affecting DrivingScene
    drive -->|"drives"| driving
    env -->|"generates"| driving
    swap -->|"swaps"| driving

    %% UI & NodeMap Functionality
    popups -->|"triggers"| mainMenu
    popups -->|"triggers"| nodeMap
    nodeScripts -->|"manages"| nodeMap

    %% Other Supporting Scripts
    cam -->|"cameras"| driving
    fuelCollect -->|"collects"| driving
    fuelCtrl -->|"controls"| driving

    %% Assets used by Scenes and Scripts
    assets -->|"provides assets to"| mainMenu
    assets -->|"provides assets to"| loading
    assets -->|"provides assets to"| driving
    assets -->|"provides assets to"| nodeMap
    assets -->|"provides assets to"| settings
    assets -->|"used by"| gm
    assets -->|"used by"| inputM
    assets -->|"used by"| drive
    assets -->|"used by"| env
    assets -->|"used by"| swap
    assets -->|"used by"| popups
    assets -->|"used by"| nodeScripts
    assets -->|"used by"| cam
    assets -->|"used by"| fuelCollect
    assets -->|"used by"| fuelCtrl

    %% Project Settings underpinning Unity Engine
    projSet -->|"configures"| U

    %% External Tools supporting development
    hub -.->|"manages project"| U
    dotnet -.->|"compiles"| gm
    git -.->|"version controls"| assets

    %% Click Events
    click mainMenu "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/Scenes/MainMenu.unity"
    click loading "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/Scenes/Loading Screen.unity"
    click driving "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/Scenes/DrivingScene.unity"
    click nodeMap "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/Scenes/NodeMap.unity"
    click settings "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/Scenes/Settings Menu.unity"
    click gm "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/Scripts/GameManager.cs"
    click inputM "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/InputSystem_Actions.inputactions"
    click drive "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/Scripts/DriveCar.cs"
    click env "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/Scripts/EnvironmentGenerator.cs"
    click swap "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/Scripts/SwapCar.cs"
    click popups "https://github.com/vinny-nguyen/uwaft-cav-game/tree/main/Assets/Resources/Popup"
    click nodeScripts "https://github.com/vinny-nguyen/uwaft-cav-game/tree/main/Assets/Scripts/NodeMap"
    click cam "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/Scripts/CameraController.cs"
    click fuelCollect "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/Scripts/CollectFuel.cs"
    click fuelCtrl "https://github.com/vinny-nguyen/uwaft-cav-game/blob/main/Assets/Scripts/FuelController.cs"
    click projSet "https://github.com/vinny-nguyen/uwaft-cav-game/tree/main/ProjectSettings/"

    %% Class Definitions for styling
    classDef unity fill:#AED6F1,stroke:#000,stroke-width:2px;
    classDef scene fill:#F9E79F,stroke:#000,stroke-width:2px;
    classDef script fill:#A9DFBF,stroke:#000,stroke-width:2px;
    classDef assets fill:#F5B7B1,stroke:#000,stroke-width:2px;
    classDef config fill:#D7BDE2,stroke:#000,stroke-width:2px;
    classDef external fill:#CCD1D1,stroke:#000,stroke-width:2px;
```
