# mahsum-altun/bridge-race-clone architecture

> Architecture diagram of the GitHub repository mahsum-altun/bridge-race-clone, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mahsum-altun/bridge-race-clone
- Repository: https://github.com/mahsum-altun/bridge-race-clone

## Overview

##### Main Components Identification

The system should be divided into these primary components:

a. Core Game Systems
- Player System
- NPC System
- Brick System
- Level Management
- Animation System

b. UI/UX Layer
- Main Menu
- In-game UI
- Sound System

c. Input/Control System
- Mobile Input (Joystick)
- Touch Controls

**[Presentation Layer]**
- UI Elements (MainMenu.cs)
- Animation Controllers
- Sound Management (SetVolume.cs)

**[Game Logic Layer]**
- Player Management
- InputManager.cs
- PlayerDie.cs
- AnimationManager.cs
- NPC System
- NPC.cs
- NPC Animation Controllers
- Brick System
- BrickSpawning.cs
- BrickTransport.cs
- StairPainting.cs

**[Core Systems]**
- Game State Management
- Physics & Collision
- Resource Management

##### Data Flow

Flow of game data:
**Input → Player Controller → Game State → UI Update**
- ↓
- Physics Check
- ↓
- Animation System

##### Key Features to Highlight

- Brick collection and stair building mechanics
- NPC AI behavior system
- Player movement and control system
- Level progression system
- Mobile-specific optimizations

##### Implementation Details

Important implementation aspects:
- Unity's Universal Render Pipeline (URP) usage
- Mobile performance optimizations
- Asset management system
- Scene management

This system design should help developers understand both the high-level architecture and the specific implementations required for this mobile game project.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Legend
        A[Game Logic]:::gamelogic --- B[UI Element]:::ui
        C[Input System]:::input --- D[Animation]:::animation
        E[Core System]:::core --- F[Sound System]:::sound
        G[Ads System]:::ads
    end

    subgraph "Presentation Layer"
        UI["Main Menu"]:::ui
        click UI "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/MainMenu.cs"
        Sound["Sound System"]:::sound
        click Sound "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/SetVolume.cs"
        SoundMixer["Audio Mixers"]:::sound
        click SoundMixer "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Music.mixer"
    end

    subgraph "Game Logic Layer"
        subgraph "Player Management"
            Input["Input Manager"]:::input
            click Input "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/Player/InputManager.cs"
            Joystick["Floating Joystick"]:::input
            click Joystick "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/Player/FloatingJoystick.cs"
            PlayerDeath["Player Die"]:::gamelogic
            click PlayerDeath "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/PlayerDie.cs"
        end

        subgraph "NPC System"
            NPC["NPC Controller"]:::gamelogic
            click NPC "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/NPC/NPC.cs"
            NPCAnimBlue["Blue NPC Animation"]:::animation
            click NPCAnimBlue "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/NPC/AnimationManagerBlue.cs"
            NPCAnimWhite["White NPC Animation"]:::animation
            click NPCAnimWhite "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/NPC/AnimationManagerWhite.cs"
            NPCAnimYellow["Yellow NPC Animation"]:::animation
            click NPCAnimYellow "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/NPC/AnimationManagerYellow.cs"
        end

        subgraph "Brick System"
            BrickSpawn["Brick Spawning"]:::gamelogic
            click BrickSpawn "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/Brick/BrickSpawning.cs"
            BrickTransport["Brick Transport"]:::gamelogic
            click BrickTransport "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/Brick/BrickTransport.cs"
            StairPaint["Stair Painting"]:::gamelogic
            click StairPaint "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/StairPainting.cs"
        end
    end

    subgraph "Core Systems"
        AnimSystem["Animation System"]:::animation
        click AnimSystem "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/AnimationManager.cs"
        PlayerAnim["Player Animations"]:::animation
        click PlayerAnim "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Import/PlayerAnim/Player.controller"
        AdsSystem["Ads Manager"]:::ads
        click AdsSystem "https://github.com/Mahsum-Altun/Bridge-race-clone/blob/main/Assets/Script/AdsManager.cs"
        Physics["Physics & Collision"]:::core
        GameState["Game State Management"]:::core
    end

    %% Relationships
    Input --> PlayerDeath
    Joystick --> Input
    Input --> GameState
    GameState --> UI
    GameState --> Sound
    Sound --> SoundMixer

    NPC --> NPCAnimBlue & NPCAnimWhite & NPCAnimYellow
    NPC --> GameState

    BrickSpawn --> BrickTransport
    BrickTransport --> StairPaint
    StairPaint --> GameState

    GameState --> AnimSystem
    AnimSystem --> PlayerAnim

    Physics --> GameState
    AdsSystem --> UI

    classDef gamelogic fill:#3498db
    classDef ui fill:#2ecc71
    classDef input fill:#e67e22
    classDef animation fill:#9b59b6
    classDef core fill:#34495e
    classDef sound fill:#95a5a6
    classDef ads fill:#e74c3c
```
