added dialogue manager and radar

This commit is contained in:
2026-02-18 13:53:02 +00:00
parent e1df65bce2
commit 23362e7bdd
11 changed files with 915 additions and 3 deletions

142
README.md Normal file
View File

@@ -0,0 +1,142 @@
# OGG
A janky boomer shooter built in Unity. Cruelty Squad aesthetics, boomer shooter mechanics. Deliberately ugly.
---
## Project Structure
```
Assets/
Scripts/ — all game code
Items/ — ItemDefinition ScriptableObjects
Models/ — 3D assets
Prefabs/ — weapon and enemy prefabs
Scenes/ — game scenes
```
---
## Systems
### Player
**`FirstPersonController.cs`**
Standard FPS controller. WASD + mouse look, sprint with Left Shift, jump with Space. Mouse look and movement are automatically frozen when the inventory or dialogue is open.
**`Player.cs`**
Tracks health and stamina. Stamina drains while sprinting and regenerates at rest. Exposes `HealthFraction` and `StaminaFraction` for the HUD.
---
### Combat
**`SimpleGun.cs`** / **`WeaponManager.cs`** / **`WeaponViewmodel.cs`**
Weapon firing, switching, and first-person viewmodel rendering. Weapons are defined as prefabs with an `ItemDefinition` ScriptableObject. A custom editor tool automates prefab generation and includes a live positioning workflow for viewmodel placement.
**`WeaponBob.cs`**
Applies positional bob to the viewmodel while moving.
**`EnemyHealth.cs`** / **`EnemyHeadHitbox.cs`**
Enemies take damage from gunfire. Headshots via a dedicated hitbox component are one-shot kills; body shots require multiple hits.
**`CameraShake.cs`**
Triggered on fire and on taking damage.
---
### Enemies
**`HumanoidEnemy.cs`**
Procedurally generated humanoid enemies with three types:
| Type | Role |
|---|---|
| Grunt | Balanced melee + ranged |
| Runner | Fast melee rusher |
| Brute | Slow, heavy, high damage |
Enemies chase, attack in melee range, and shoot at range. AI uses Unity's `CharacterController` with custom state logic (idle → chase → attack).
**`EnemySpawner.cs`**
Spawns enemies into the scene.
---
### Inventory
**`Inventory.cs`**
Grid-based inventory opened with Tab. Supports weapons and equippable non-weapon items. Right-click context menu for equipping/dropping. Pauses mouse look when open.
**`ItemDefinition.cs`**
ScriptableObject defining an item: name, icon, type, weapon prefab reference, and equippable stats.
**`PickupItem.cs`**
Attach to any world object to make it a pickup. Spins and bobs in the world. Supports full `ItemDefinition` or a simple name fallback.
**`StaminaBoostPickup.cs`** / **`BootsEffect.cs`**
"Bunny Hop Boots" equippable item. Grants a passive stamina boost rather than Quake-style bunny hopping — more accessible, still rewarding.
---
### HUD
**`PlayerHUD.cs`**
Draws health and stamina bars in the bottom-left corner using Unity's immediate-mode GUI (`OnGUI`). Bars smooth-interpolate, pulse red at critical values, and have 25% segment tick marks. Includes a colour-coded speedometer (green → yellow → red).
**`RadarHUD.cs`**
Circular mini-map in the top-left corner. Rotates with the player so "up" always equals forward.
| Blip | Colour | Shape |
|---|---|---|
| Player | White | Round |
| Enemy (`HumanoidEnemy`) | Red (pulsing) | Round |
| NPC (`DialogueNPC`) | Green | Round |
| Pickup (`PickupItem`) | Yellow | Square |
Enemies beyond radar range are clamped to the disc edge. Scene is re-scanned every 0.25 seconds.
**`SimpleCrosshair.cs`**
Minimal crosshair overlay.
---
### Dialogue
**`DialogueNPC.cs`**
Attach to any world object (NPC, terminal, sign, etc.) to make it interactable. When the player looks at it within range, a floating `[E] Talk` prompt appears in world space. Press E to open the dialogue box.
Configurable per object:
- `interactRange` — how close the player needs to be
- `interactAngle` — how directly they need to be looking
- `lines[]` — array of speaker/page blocks (fill in the Inspector)
**`DialogueManager.cs`** *(singleton)*
Renders the dialogue box at the bottom of the screen. Typewriter text effect, page dot indicators, speaker name bar. Unlocks the cursor while open and re-locks it on close.
Controls while dialogue is open:
| Key | Action |
|---|---|
| E / Space / Enter | Advance page (or skip typewriter) |
| Escape | Close immediately |
Rich text tags (`<b>`, `<color=red>`, `<i>`) work in dialogue body text.
**`DialogueLine.cs`**
Serializable data class. One `DialogueLine` = one speaker with an array of text pages. Multiple `DialogueLine` entries per NPC chain speakers together.
---
## Setup Cheatsheet
| What | Component | Where to attach |
|---|---|---|
| Player movement | `FirstPersonController` | Player GameObject |
| Health / stamina | `Player` | Player GameObject |
| HUD bars + speedo | `PlayerHUD` | Player GameObject |
| Mini-map radar | `RadarHUD` | Player GameObject |
| Dialogue system | `DialogueManager` | Any persistent GameObject (e.g. a "Managers" empty) |
| Make something talkable | `DialogueNPC` | The NPC / object |
| Make something a pickup | `PickupItem` | The pickup object |
| Make something an enemy | `HumanoidEnemy` + `EnemyHealth` | Enemy GameObject |