defines or replaces one state's music mapping
switches to state's track, crossfading; a no-op if that track is already playing
registers the one-shot sound played by trigger(event)
plays the sound registered for event, if any; silently does nothing otherwise
The data a game writes once instead of scattering
Music.play/Sound.playcalls across every place a fight starts or a menu opens: name the states ("exploring", "combat", "boss", "menu") and the cues ("hit", "levelUp"), and callenter/triggerby name from then on.enteris idempotent by track, not by state name - two state names that happen to map to the same track will not refade into each other either, since there is nothing to refade to. Re-entering "combat" mid-fight (the same fight, the same track) must not reset the music, which is the one behaviour a directMusic.playcall at every call site cannot give you for free: the orchestrator remembers the current track and treats entering an already-current one as a no-op.Cues are separate from states because they are fire-and-forget one-shots (
Sound, notMusic) - folding them intoenterwould conflate "this is where we are" with "this just happened".Example