# husnainhaider/ar-treasure-hunt architecture

> Architecture diagram of the GitHub repository husnainhaider/ar-treasure-hunt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/husnainhaider/ar-treasure-hunt
- Repository: https://github.com/husnainhaider/ar-treasure-hunt

## Overview

Treasure Hunt AR is a Unity mobile AR game: players scan a real surface, place a ship, collect treasure against a 30-second limit, and avoid the Kraken. The tree identifies likely implementation scripts for placement, treasure, ship, and enemy behavior, but no source excerpts were supplied. Accordingly, the graph maps documented gameplay stages to those paths and uses the README as relationship evidence; internal calls and asset wiring are not asserted.

Main entry points: [`Assets/Scripts/CarBehaviour.cs`](https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/CarBehaviour.cs) (Ship behavior), [`Assets/Scripts/DrivingSurfaceManager.cs`](https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/DrivingSurfaceManager.cs) (Surface scanning), [`Assets/Scripts/PlaceObject.cs`](https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/PlaceObject.cs) (Ship placement), [`Assets/Scripts/PackageSpawner.cs`](https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/PackageSpawner.cs) (Treasure spawning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ar["AR interaction"]
  node_surface["Surface scanning"]
  node_placement["Ship placement<br/>[PlaceObject.cs]"]
  node_reticle["Placement reticle"]
  node_lighting["Light estimation<br/>[LightEstimation.cs]"]
end

subgraph group_game["Game loop"]
  node_ship["Ship behavior<br/>[CarBehaviour.cs]"]
  node_treasure["Treasure spawning<br/>[PackageSpawner.cs]"]
  node_package["Treasure behavior"]
end

subgraph group_world["Game world"]
  node_kraken["Kraken threat<br/>[EnnemyBehaviour.cs]"]
end

node_player(("Player"))
node_arfoundation["AR Foundation"]

node_player -->|"scans surroundings"| node_surface
node_surface -->|"enables placement"| node_placement
node_player -->|"taps to spawn"| node_placement
node_placement -->|"places ship"| node_ship
node_ship -->|"collects treasure"| node_treasure
node_ship -->|"avoids threat"| node_kraken
node_arfoundation -.->|"supports AR scan"| node_surface

click node_surface "https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/DrivingSurfaceManager.cs"
click node_placement "https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/PlaceObject.cs"
click node_ship "https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/CarBehaviour.cs"
click node_treasure "https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/PackageSpawner.cs"
click node_package "https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/PackageBehaviour.cs"
click node_kraken "https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/EnnemyBehaviour.cs"
click node_reticle "https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/CrossHairBehavior.cs"
click node_lighting "https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/LightEstimation.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_surface,node_placement,node_reticle,node_lighting toneBlue
class node_ship,node_treasure,node_package toneAmber
class node_kraken toneMint
class node_player,node_arfoundation toneIndigo
```

## Components

### AR interaction

- [Surface scanning](https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/DrivingSurfaceManager.cs): `Assets/Scripts/DrivingSurfaceManager.cs`
- [Ship placement](https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/PlaceObject.cs): `Assets/Scripts/PlaceObject.cs`
- [Placement reticle](https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/CrossHairBehavior.cs): `Assets/Scripts/CrossHairBehavior.cs`
- [Light estimation](https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/LightEstimation.cs): `Assets/Scripts/LightEstimation.cs`

### Game loop

- [Ship behavior](https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/CarBehaviour.cs): `Assets/Scripts/CarBehaviour.cs`
- [Treasure spawning](https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/PackageSpawner.cs): `Assets/Scripts/PackageSpawner.cs`
- [Treasure behavior](https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/PackageBehaviour.cs): `Assets/Scripts/PackageBehaviour.cs`

### Game world

- [Kraken threat](https://github.com/husnainhaider/ar-treasure-hunt/blob/main/Assets/Scripts/EnnemyBehaviour.cs): `Assets/Scripts/EnnemyBehaviour.cs`

### Other components

- **Player**
- **AR Foundation**

## Connections

- Player → Surface scanning: scans surroundings
- Surface scanning → Ship placement: enables placement
- Player → Ship placement: taps to spawn
- Ship placement → Ship behavior: places ship
- Ship behavior → Treasure spawning: collects treasure
- Ship behavior → Kraken threat: avoids threat
- AR Foundation → Surface scanning: supports AR scan
