AI Command Lab // Flight Simulator
203C: The View Controller
Initial AI Output (Fragile)
// AI-Generated Code: Bad Dependency
class Player {
public Text healthText; // Dependency
void TakeDamage() {
health--;
healthText.text = health.ToString();
}
}
Initial AI Prompt
"You ask the AI: "Update the health bar when I take damage.""
Pilot Comm Link
Mission Objective: A skilled Pilot directs the AI to use Events. You command: "Fire a OnHealthChanged event. Let a separate UIController script listen and update the label."
Optimized Protocol
// Corrected: Decoupled // Player Script: public Action<int> OnHealthChanged; // UI Controller Script: player.OnHealthChanged += (h) => label.text = h.ToString();