# mathyasgiudici/polimi-aui-magicorchestra architecture

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

- Interactive diagram: https://gitdiagram.com/mathyasgiudici/polimi-aui-magicorchestra
- Repository: https://github.com/mathyasgiudici/polimi-aui-magicorchestra

## Overview

##### Project Type and Key Purpose
- The project is a Unity-based interactive application aimed at brain-training through three games (InstruMaps, Quanti Numeri, and Sinfonia di Luci). Its goal is to offer different activities that challenge and train memory in an immersive, multi-sensory environment.
- It supports two modes of operation—a guided “story mode” and split, independent game modes—while also allowing an as-context-free experience.

##### Key Components (as discovered from the file structure)
a. Game Engine & Scenes:
– The central Unity engine (evidenced by folders like Assets, ProjectSettings, Packages, and Unity-specific file types).
– Multiple Scenes (under Assets/Scenes) corresponding to various game states (e.g., Launcher, CutScenePlayer, Game2, InstruMaps, MagicOrchestra, etc.)

b. Game Modes and Controllers:
– “MagicOrchestraScripts” contains subdirectories for each game (e.g., Game1_InstruMaps, Game2, Game3_CorsiTest) as well as general controllers in “GeneralController.”
– Controllers and managers (ExperienceManagerComunication, GameCanvasControllers, etc.) manage game flow, state, UI, and interactivity.

c. Input and Sensor Integration:
– Presence of scripts such as KinectBodySkeleton, KinectMapper, and UDPListenerForMagiKRoom indicates integration with smart sensors and possibly Kinect hardware.
– “Smart Object Sensor” scripts show that physical objects in the smart space are monitored and controlled.

d. Multimedia & Resources:
– Assets include audio (Assets/Resources/Audio and UIgraphics/Sounds), video (Assets/StreamingAssets/Videos), sprites, fonts, and materials.
– These resources are used within the different scenes to support the multi-sensory brain training experience.

e. External Plugins and APIs:
– The LightShaft and YoutubeAPI folders, along with Plugin directories (e.g., Assets/Plugins/GitHub), indicate incorporation of multimedia and external service integrations (like YouTube content).
– They provide advanced rendering (for video playback, effects) and access to external content.

##### Architectural Patterns and Design Principles
- The project follows a component-based modular design typical of Unity projects. Each game mode and sensor management component acts as an independent module.
- There’s a clear separation of concerns—input handling and game state management (logic are separated from asset management and UI).
- Controllers and Managers, along with utility scripts and parameter settings, suggest a design where independent components communicate primarily through well-defined interfaces or event messaging systems.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Engine"
        A["Unity Engine"]:::core
    end

    subgraph "Presentation/UI Layer"
        B["Game Scenes"]:::presentation
        C["UI Manager"]:::presentation
    end

    subgraph "Game Logic Layer"
        D["Controller: Game1_InstruMaps"]:::logic
        E["Controller: Game2"]:::logic
        F["Controller: Game3_CorsiTest"]:::logic
        G["General Controller"]:::logic
    end

    subgraph "Input & Sensor Layer"
        H["Sensor Manager (Kinect,SmartSensor,UDPListener)"]:::input
    end

    subgraph "Media Resource Layer"
        I["Media Resources"]:::media
        J["Streaming Assets"]:::media
        K["UI Graphics"]:::media
    end

    subgraph "External Services & Plugins"
        L["YouTube API"]:::external
        M["GitHub Plugin"]:::external
    end

    %% Connections
    A -->|"runs"| B
    A -->|"manages"| C
    B -->|"triggers"| D
    B -->|"triggers"| E
    B -->|"triggers"| F
    B -->|"triggers"| G
    H -->|"sendsData"| D
    H -->|"sendsData"| E
    H -->|"sendsData"| F
    H -->|"sendsData"| G
    I -->|"loadsAssets"| B
    J -->|"suppliesMedia"| I
    K -->|"providesUI"| C
    L -->|"enhancesMedia"| I
    M -->|"extendsLogic"| D

    %% Click Events
    click B "https://github.com/mathyasgiudici/polimi-aui-magicorchestra/tree/master/Assets/Scenes"
    click D "https://github.com/mathyasgiudici/polimi-aui-magicorchestra/tree/master/Assets/scripts/MagicOrchestraScripts/Game1_InstruMaps"
    click E "https://github.com/mathyasgiudici/polimi-aui-magicorchestra/tree/master/Assets/scripts/MagicOrchestraScripts/Game2"
    click F "https://github.com/mathyasgiudici/polimi-aui-magicorchestra/tree/master/Assets/scripts/MagicOrchestraScripts/Game3_CorsiTest"
    click G "https://github.com/mathyasgiudici/polimi-aui-magicorchestra/tree/master/Assets/scripts/MagicOrchestraScripts/GeneralController"
    click H "https://github.com/mathyasgiudici/polimi-aui-magicorchestra/tree/master/Assets/scripts/MagiKRomScripts"
    click I "https://github.com/mathyasgiudici/polimi-aui-magicorchestra/tree/master/Assets/Resources"
    click J "https://github.com/mathyasgiudici/polimi-aui-magicorchestra/tree/master/Assets/StreamingAssets"
    click K "https://github.com/mathyasgiudici/polimi-aui-magicorchestra/tree/master/UIgraphics"
    click L "https://github.com/mathyasgiudici/polimi-aui-magicorchestra/tree/master/Assets/LightShaft"
    click M "https://github.com/mathyasgiudici/polimi-aui-magicorchestra/tree/master/Assets/Plugins/GitHub"

    %% Styles
    classDef core fill:#D8BFD8,stroke:#4B0082,stroke-width:2px;
    classDef presentation fill:#ADD8E6,stroke:#00008B,stroke-width:2px;
    classDef logic fill:#90EE90,stroke:#006400,stroke-width:2px;
    classDef input fill:#FFA07A,stroke:#CD5C5C,stroke-width:2px;
    classDef media fill:#FFFF99,stroke:#DAA520,stroke-width:2px;
    classDef external fill:#FFB6C1,stroke:#C71585,stroke-width:2px;

    class A core;
    class B,C presentation;
    class D,E,F,G logic;
    class H input;
    class I,J,K media;
    class L,M external;
```
