Tier 4 Series 301

301D: Cross-Scene Comms

Pilot Record
Student Profile
"In a complex flight deck, the Radar system and the Landing Gear are separate units. The Radar shouldn't need a direct physical wire to the Gear's internal gears just to know when the ship is landing. They communicate via a **Signal Bus**. If your AI is forcing your persistent managers to search for each other directly, you've created a **Spaghetti Circuit**."

The Concept: Global Events

As detailed in **Chapter 8**, global systems should be "loosely coupled". This means the `QuestManager` doesn't need to know the `AudioManager` exists; it simply broadcasts an event saying "Quest Complete," and any system listening (like sound effects or UI) reacts accordingly.

The Communicator's Advantage:
* **Independence:** You can load and test the Audio system without needing the entire Quest system active.
* **Scalability:** Easily add 10 new reactions to a single event without changing the original code.
* **Maintenance:** Fix bugs in the signal receiver without breaking the signal broadcaster.
Red Flag Detected

The AI Trap: "The Manager Dependency"

You ask the AI: "Play a 'Success' sound whenever a quest is completed."

// AI-Generated Code: Hard-Wired Managers
public class QuestManager : MonoBehaviour {
    // Audit Fail: QuestManager cannot exist without AudioManager!
    public AudioManager audioMan; 

    public void CompleteQuest() {
        audioMan.PlaySuccessSound(); 
    }
}

This is "System Entanglement." If you try to test a new scene that only needs quests, the game will crash because the `AudioManager` is missing. A professional Navigator uses a **Static Event** to broadcast the signal into the void, allowing listeners to pick it up if they are present.

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 Correction

Corrective Protocol
// The Signal (Broadcaster)
public class QuestManager : MonoBehaviour {
    public static event Action OnQuestCompleted;

    public void CompleteQuest() {
        OnQuestCompleted?.Invoke(); // Broadcast to whoever is listening
    }
}

// The Receiver (Subscriber)
public class AudioManager : MonoBehaviour {
    void OnEnable() => QuestManager.OnQuestCompleted += PlaySound;
    void OnDisable() => QuestManager.OnQuestCompleted -= PlaySound;
}
Your Pilot Command
> A skilled Pilot directs the AI to use an Action-based Signal.
Next Mission
Regional Buffers