AI Command Lab // Flight Simulator
6B: The Message Broadcast
Initial AI Output (Fragile)
// AI-Generated Code: Dependency Explosion
void Die() {
gameManager.GameOver();
soundManager.PlayScream();
uiManager.FadeOut();
animationManager.PlayDeathAnim();
// Audit Fail: The Player knows too much!
}
Initial AI Prompt
"You ask the AI: "When the player dies, notify the Game Manager, Sound Manager, and UI Manager.""
Pilot Comm Link
Mission Objective: A skilled Mechanic directs the AI to use a UnityEvent. You command: "Use a UnityEvent so the Player script doesn't need to know who is listening."
Optimized Protocol
// Corrected: The Player just "Broadcasts"
[SerializeField] private UnityEvent onDeath;
void Die() {
onDeath.Invoke();
}