# elifnazlib/trijam279 architecture

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

- Interactive diagram: https://gitdiagram.com/elifnazlib/trijam279
- Repository: https://github.com/elifnazlib/trijam279

## Overview

##### Main Components
- Scene Management: Include the Scene(s) from the Assets/Scenes folder (for example, “SampleScene.unity”). This is where the game’s visual and interactive elements are instantiated.
- Game Logic/Scripts: Highlight the scripts in Assets/Scripts such as PlayerController, Tile, TileController, TimelineController, and SingletonMusic. Each script corresponds to elements like player input, game physics, tile-based map management, music control, and timeline events.
- Animation System: Represent the Animations folder and controllers (e.g., Sun Anim Controller, Sunflower Anim Controller) which manage character or object animations. Connect these to the appropriate game objects in the scene.
- Audio System: Mark the Audio folder and indicate how the audio file(s) integrate with the music and sound effect systems (using the SingletonMusic or other audio control mechanisms).
- Timeline and Cinematics: Include the Assets/Timeline folder to show that timeline assets (like the Sun Movement playable) play a role in orchestrating events or transitions over the game duration.
- External Libraries/Assets: Optionally, show components such as TextMesh Pro which are used for on-screen text rendering, highlighting that they’re third-party assets integrated into the game.

##### Relationships and Interactions
- That Scenes serve as the hub connecting various systems: link game logic (scripts) with scene objects, animations (via controllers and animator components), audio, and timeline events.
- Within game logic, show interactions between the PlayerController (handling input and movement), Tile/TileController (managing game board or level design), and TimelineController (synchronizing events).
- Animation System to both the scene objects and timeline (if timeline events trigger specific animations).
- Link the Audio System to the game logic (SingletonMusic) which ensures that audio behavior is consistent across scenes.

##### Architectural Patterns and Design Principles
- Unity’s component-based architecture where scripts are attached to GameObjects.
- Singleton patterns (as seen in SingletonMusic.cs) and show how they provide global access across systems.
- Model-View separation inherent in a game like this, where the game state (logic/control) is distinct from presentation (scene, animations).

##### Technologies and Frameworks
- Unity Engine is the primary platform.
- C# scripts drive the game logic.
- Third-party assets (like TextMesh Pro) for UI rendering.
- Timeline and animation controllers for event sequencing.
- Audio files for background music and sound effects integrated via Unity’s audio system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    UE["Unity Engine (Runtime)"]:::engine
    SM["Scene Management: SampleScene.unity"]:::scene
    GP["Game Logic/Scripts"]:::logic
    TL["Timeline and Cinematics"]:::timeline
    ANIM["Animation System"]:::anim
    AUDIO["Audio System"]:::audio
    EXT["External Libraries: TextMesh Pro"]:::external

    %% Main vertical chain
    UE --> SM
    SM --> GP
    GP --> TL
    TL --> ANIM
    ANIM --> AUDIO
    AUDIO --> EXT

    %% Detailed breakdown for Game Logic/Scripts
    subgraph "Game Logic Details"
        PC["PlayerController"]:::logic
        T["Tile"]:::logic
        TC["TileController"]:::logic
        TLC["TimelineController"]:::logic
        SMusic["SingletonMusic"]:::logic
    end
    %% Link container to details (dotted lines for grouping)
    GP --- PC
    GP --- T
    GP --- TC
    GP --- TLC
    GP --- SMusic

    %% Interactions within Game Logic
    PC -->|"handles"| T
    PC -->|"handles"| TC
    T -->|"managedBy"| TC
    PC -->|"triggers"| TLC

    %% Timeline and Cinematics details
    subgraph "Timeline Details"
        SMOV["Sun Movement"]:::timeline
    end
    %% TimelineController triggers timeline asset
    TLC -->|"triggers"| SMOV

    %% Animation System details
    subgraph "Animation Details"
        SA["Sun Anim Controller"]:::anim
        SFA["Sunflower Anim Controller"]:::anim
    end
    %% Timeline activates animations
    TL -->|"activates"| SA
    TL -->|"activates"| SFA

    %% Audio System detail: music file
    AF["Music: Podington Bear - Thimble Of Sun"]:::audio
    AUDIO --- AF
    %% SingletonMusic controls audio
    SMusic -->|"controls"| AUDIO

    %% Click Events for component mappings
    click SM "https://github.com/elifnazlib/trijam279/blob/main/Assets/Scenes/SampleScene.unity"
    click GP "https://github.com/elifnazlib/trijam279/tree/main/Assets/Scripts"
    click PC "https://github.com/elifnazlib/trijam279/blob/main/Assets/Scripts/PlayerController.cs"
    click T "https://github.com/elifnazlib/trijam279/blob/main/Assets/Scripts/Tile.cs"
    click TC "https://github.com/elifnazlib/trijam279/blob/main/Assets/Scripts/TileController.cs"
    click TLC "https://github.com/elifnazlib/trijam279/blob/main/Assets/Scripts/TimelineController.cs"
    click SMusic "https://github.com/elifnazlib/trijam279/blob/main/Assets/Scripts/SingletonMusic.cs"
    click ANIM "https://github.com/elifnazlib/trijam279/tree/main/Assets/Animations"
    click SA "https://github.com/elifnazlib/trijam279/blob/main/Assets/Animations/Sun Anim Controller.controller"
    click SFA "https://github.com/elifnazlib/trijam279/blob/main/Assets/Animations/Sunflower Anim Controller.controller"
    click AUDIO "https://github.com/elifnazlib/trijam279/tree/main/Assets/Audio"
    click AF "https://github.com/elifnazlib/trijam279/blob/main/Assets/Audio/Podington Bear - Thimble Of Sun.mp3"
    click TL "https://github.com/elifnazlib/trijam279/tree/main/Assets/Timeline"
    click SMOV "https://github.com/elifnazlib/trijam279/blob/main/Assets/Timeline/Sun Movement.playable"
    click EXT "https://github.com/elifnazlib/trijam279/tree/main/Assets/TextMesh Pro"

    %% Styles
    classDef engine fill:#B3CDE0,stroke:#03396C,stroke-width:2px;
    classDef scene fill:#FBB4AE,stroke:#990000,stroke-width:2px;
    classDef logic fill:#CCEBC5,stroke:#006400,stroke-width:2px;
    classDef timeline fill:#DECBE4,stroke:#4B0082,stroke-width:2px;
    classDef anim fill:#FED9A6,stroke:#B22222,stroke-width:2px;
    classDef audio fill:#FFFFCC,stroke:#DAA520,stroke-width:2px;
    classDef external fill:#FDD7E4,stroke:#C71585,stroke-width:2px;
```
