Unit 3 — The Turret
The first enemy that shoots. Distance checks, Instantiated projectiles, and the cooldown — the single most reused pattern of the year — all arrive in four lessons that end in a tuned, playtested threat.
Lessons
| ID | Title | What you build / learn |
|---|---|---|
| 3.1 | The Turret: Distance & the Detection Radius | Vector3.Distance as a region in space |
| 3.2 | Projectiles: Instantiate, Fire, Destroy | spawn, aim, rotate, travel, die |
| 3.3 | Fire Rate: Cooldowns & Time | Time.time, lastAttackTime, the compound conditional |
| 3.4 | Projectile Damage, Tuning & Playtest | giving the bullet a collider, then tuning four knobs |
Concepts this unit owns
The cooldown/timestamp pattern is taught here and reused by enemy contact damage, your own swing, jump mercies, and turn gates. CED: AAP-1 (procedural abstraction: AttackPlayer hides the fire path), AAP-2 (calling procedures), AAP-3 (logic in compound conditionals).