# Breakpilot Drive - Prefab Konfiguration

Diese Anleitung beschreibt, wie die Prefabs fuer das Spiel konfiguriert werden.

---

## 1. Spieler-Auto (Player)

### Prefab erstellen

1. Aus Kenney Car Kit ein Auto waehlen
2. In die Szene ziehen
3. Umbenennen zu "PlayerCar"

### Komponenten

| Komponente | Einstellungen |
|------------|---------------|
| **Transform** | Position: (0, 0, 0), Scale: (1, 1, 1) |
| **Rigidbody** | Use Gravity: false, Is Kinematic: true |
| **Box Collider** | Is Trigger: false, Size an Auto anpassen |
| **PlayerController** | Lane Distance: 3, Lane Switch Speed: 10 |

### Inspector-Einstellungen (PlayerController)

```
Bewegung:
  Lane Distance: 3
  Lane Switch Speed: 10
  Forward Speed: 10

Spuren:
  Current Lane: 1 (Mitte)

Touch-Steuerung:
  Swipe Threshold: 50

Effekte:
  Crash Effect: (ParticleSystem zuweisen)
  Collect Effect: (ParticleSystem zuweisen)
```

### Tag

- Tag: **Player**

### Speichern

- Aus Hierarchy in `Assets/Prefabs/Player/` ziehen
- Name: `PlayerCar.prefab`

---

## 2. Strecken-Segment (Track)

### Prefab erstellen

1. Leeres GameObject: "TrackSegment"
2. Boden erstellen:
   - 3D Object → Plane
   - Scale: (5, 1, 5) fuer 50m Laenge
   - Material: Strassen-Textur

### Struktur

```
TrackSegment
├── Ground (Plane mit Strassen-Material)
├── LeftBorder (optional, Leitplanke)
├── RightBorder (optional, Leitplanke)
└── SpawnPoints (leeres GO fuer Hindernis-Positionen)
```

### Speichern

- Mehrere Varianten erstellen (gerade, Kurve, etc.)
- In `Assets/Prefabs/Track/` speichern

---

## 3. Hindernisse (Obstacles)

### Hindernis-Prefab erstellen

1. Aus Kenney Nature Kit: Stein, Baum, etc. waehlen
2. In Szene ziehen
3. Umbenennen (z.B. "Obstacle_Rock")

### Komponenten

| Komponente | Einstellungen |
|------------|---------------|
| **Box Collider** | Is Trigger: true, Size anpassen |

### Tag

- Tag: **Obstacle**

### Prefab-Varianten

| Name | Beschreibung | Groesse |
|------|--------------|---------|
| `Obstacle_Rock.prefab` | Kleiner Stein | 1 Spur |
| `Obstacle_Tree.prefab` | Umgefallener Baum | 2 Spuren |
| `Obstacle_Barrier.prefab` | Absperrung | 1-2 Spuren |
| `Obstacle_Cone.prefab` | Verkehrskegel | 1 Spur |

### Speichern

- In `Assets/Prefabs/Obstacles/` speichern

---

## 4. Sammelbare Items

### Coin-Prefab

1. 3D Object → Cylinder (oder Kenney Asset)
2. Scale: (0.5, 0.1, 0.5)
3. Material: Gold

| Komponente | Einstellungen |
|------------|---------------|
| **Sphere Collider** | Is Trigger: true, Radius: 0.5 |
| **Rotation Script** | (optional, fuer Dreh-Animation) |

- Tag: **Coin**
- Prefab: `Assets/Prefabs/Items/Coin.prefab`

### Star-Prefab

1. Star-Modell (oder Kenney Asset)
2. Groesser als Coin

| Komponente | Einstellungen |
|------------|---------------|
| **Sphere Collider** | Is Trigger: true, Radius: 0.7 |

- Tag: **Star**
- Prefab: `Assets/Prefabs/Items/Star.prefab`

### Shield-Prefab

1. Shield-Modell
2. Blauer Schimmer-Effekt

| Komponente | Einstellungen |
|------------|---------------|
| **Sphere Collider** | Is Trigger: true, Radius: 0.7 |

- Tag: **Shield**
- Prefab: `Assets/Prefabs/Items/Shield.prefab`

---

## 5. Quiz-Trigger (Visual Triggers)

### Bridge-Prefab

1. Aus Kenney Assets oder selbst erstellen
2. Muss ueber der Strasse sein (Y-Position erhoehen)

### Struktur

```
Bridge
├── BridgeModel (visuelles Modell)
└── TriggerZone (leeres GO mit Collider)
    └── Box Collider (Is Trigger: true)
    └── VisualTrigger.cs (Trigger Type: "bridge")
```

### Komponenten (TriggerZone)

| Komponente | Einstellungen |
|------------|---------------|
| **Box Collider** | Is Trigger: true, Size: (10, 5, 2) |
| **VisualTrigger** | Trigger Type: "bridge" |

- Tag: **QuizTrigger**

### Weitere Trigger

| Prefab | Trigger Type | Beschreibung |
|--------|--------------|--------------|
| `Bridge.prefab` | "bridge" | Bruecke ueber Strasse |
| `Tree.prefab` | "tree" | Grosser Baum am Rand |
| `House.prefab` | "house" | Haus am Rand |
| `Sign.prefab` | "sign" | Schild mit Bild |

### Speichern

- In `Assets/Prefabs/VisualTriggers/` speichern

---

## 6. Manager-Objekte

Diese werden nicht als Prefabs, sondern direkt in der Szene erstellt:

### GameManager

```
GameObject: GameManager
Scripts:
  - GameManager.cs

Inspector:
  Start Lives: 3
  Pause Question Interval: 500
  Game Over Panel: (UI Referenz)
  Pause Panel: (UI Referenz)
```

### QuizManager

```
GameObject: QuizManager
Scripts:
  - QuizManager.cs

Inspector:
  Quick Quiz Panel: (UI Referenz)
  Pause Quiz Panel: (UI Referenz)
  Question Text: (TextMeshPro Referenz)
  Answer Buttons: [Button0, Button1, Button2, Button3]
  Timer Text: (TextMeshPro Referenz)
  Timer Slider: (Slider Referenz)
  Points Correct: 500
  Points Wrong: -100
  Pause Question Interval: 500
```

### TrackGenerator

```
GameObject: TrackGenerator
Scripts:
  - TrackGenerator.cs

Inspector:
  Track Segment Prefabs: [Segment1, Segment2, ...]
  Start Segment Prefab: (Start-Segment)
  Segment Length: 50
  Visible Segments: 5
  Despawn Distance: -20
  Base Speed: 10
```

### ObstacleSpawner

```
GameObject: ObstacleSpawner
Scripts:
  - ObstacleSpawner.cs

Inspector:
  Obstacle Prefabs: [Rock, Tree, Barrier, ...]
  Large Obstacle Prefabs: [LargeTree, ...]
  Coin Prefab: (Coin.prefab)
  Star Prefab: (Star.prefab)
  Shield Prefab: (Shield.prefab)
  Bridge Prefab: (Bridge.prefab)
  Tree Prefab: (Tree.prefab)
  House Prefab: (House.prefab)

  Lane Distance: 3
  Min Obstacle Spacing: 10
  Max Obstacle Spacing: 30

  Obstacle Chance: 0.6
  Coin Chance: 0.3
  Star Chance: 0.05
  Shield Chance: 0.02
  Quiz Trigger Chance: 0.1
```

### BreakpilotAPI

```
GameObject: BreakpilotAPI
Scripts:
  - BreakpilotAPI.cs

Inspector:
  Base URL: http://localhost:8000/api/game
  Use Offline Cache: true
```

---

## 7. UI Canvas

### Canvas erstellen

1. Rechtsklick in Hierarchy → UI → Canvas
2. Canvas Scaler:
   - UI Scale Mode: Scale With Screen Size
   - Reference Resolution: 1920 x 1080

### UI Struktur

```
Canvas
├── GameHUD
│   ├── ScorePanel
│   │   ├── ScoreIcon
│   │   └── ScoreText (TextMeshPro)
│   ├── LivesPanel
│   │   ├── Heart1, Heart2, Heart3 (Images)
│   │   └── LivesText (TextMeshPro)
│   └── DistanceText (TextMeshPro)
│
├── QuickQuizPanel (anfangs deaktiviert)
│   ├── QuestionText (TextMeshPro)
│   ├── AnswerButtons
│   │   ├── Button1, Button2, Button3
│   ├── TimerSlider
│   └── TimerText
│
├── PauseQuizPanel (anfangs deaktiviert)
│   ├── Background (halbtransparent)
│   ├── QuestionPanel
│   │   ├── QuestionText
│   │   ├── Button1, Button2, Button3, Button4
│   │   └── HintText (optional)
│
├── GameOverPanel (anfangs deaktiviert)
│   ├── GameOverText
│   ├── FinalScoreText
│   ├── RestartButton
│   └── MainMenuButton
│
└── PausePanel (anfangs deaktiviert)
    ├── PauseText
    ├── ResumeButton
    └── MainMenuButton
```

---

## 8. Checkliste

### Prefabs erstellt?

- [ ] PlayerCar.prefab
- [ ] TrackSegment.prefab (mindestens 1)
- [ ] Obstacle_Rock.prefab
- [ ] Coin.prefab
- [ ] Star.prefab
- [ ] Shield.prefab
- [ ] Bridge.prefab (Quiz-Trigger)

### Manager konfiguriert?

- [ ] GameManager - alle UI Referenzen gesetzt
- [ ] QuizManager - alle UI Referenzen gesetzt
- [ ] TrackGenerator - Prefabs zugewiesen
- [ ] ObstacleSpawner - Prefabs zugewiesen
- [ ] BreakpilotAPI - Base URL korrekt

### Tags erstellt?

- [ ] Player
- [ ] Obstacle
- [ ] Coin
- [ ] Star
- [ ] Shield
- [ ] QuizTrigger

### UI Canvas?

- [ ] Canvas Scaler konfiguriert
- [ ] GameHUD erstellt
- [ ] QuickQuizPanel erstellt
- [ ] PauseQuizPanel erstellt
- [ ] GameOverPanel erstellt
