Tier 1
Series 1
1E: The Blueprint
"A plane isn't one solid piece of metal. It's a collection of Modules. The Engine is one module, the Navigation system is another. If the engine fails, you want to be able to fix it without having to take apart the seats in the cabin. In C#, Classes are your modules."
The Concept: Single Responsibility
In Chapter 3, we define a Class as a blueprint. Professional AI Operators follow the Single Responsibility Principle: Each class should do one thing well.
Red Flag Detected
The AI Trap: "The God Script"
You ask a simple AI: "Write a player script for JumpQuest that handles movement, health, and gold collection."
// PlayerManager.cs (Audit Failure: Too Tangled!)
public class PlayerManager : MonoBehaviour {
// Movement data
// Health data
// Coin data
void Update() {
// 50 lines of movement logic
// 30 lines of damage logic
// 20 lines of UI updating
}
}
If you want to use that same "Health" system for an Enemy later, you can't! It's welded inside the Player script. This is the "0.4 mph" of architecture—it technically runs, but it's a disaster to maintain.
Elite Telemetry
Research shows "Elite" teams achieve 15% faster lead times by keeping AI on a "very tight leash."
- Small Batches Solving one problem at a time prevents logic drift.
- Modular Design Localizing the "blast radius" of AI changes.
- Tight Loops Rapid iteration with constant code review.
The Pilot's Command
Corrective Protocol
// Result: The Modular Approach
public class HealthSystem : MonoBehaviour {
public int currentHealth;
public void TakeDamage(int amount) { /* Logic */ }
}
// Now the Player AND Enemies can use this same module!
Your Pilot Command
> Tell the AI to multiply the movement by Time.deltaTime for frame rate independence.