public void PlayCueUI(Cue cue, int playerIndex, bool useHudStereo) { var parameters = PlayCueParameters.GetParameters(cue, random, GameState.cueStates); // ^^^^ Affects gameplay || Local-only vvvv if (soundRollbackManager != null) { var fpp = new FadePitchPan(1f); if (useHudStereo) // TODO: Consider not using stereo if only one player is in game? { fpp.pan = -0.6f + 0.4f * playerIndex; // NOTE: Not using "audio space" because we don't want normal camera effects for HUD audio } var playLocally = (localPlayerBits & (1 << playerIndex)) != 0; // NOTE: Cheat and use an impossible world position so it (really) can't interfere with in-game sounds #if DEVELOPER soundRollbackManager.PlayCue(Definitions, cue, new Position(-6000 + 4000 * playerIndex, -100000, 0), fpp, parameters, playLocally); #else soundRollbackManager.PlayCueSkipMissingCheck(Definitions, cue, new Position(-6000 + 4000 * playerIndex, -100000, 0), fpp, parameters, playLocally); #endif } }
/// <summary>Play a cue in a world-space position (relative to the camera)</summary> public void PlayCueWorld(Cue cue, Actor source) { var parameters = PlayCueParameters.GetParameters(Definitions, cue, random, GameState.cueStates); // ^^^^ Affects gameplay || Local-only vvvv if (soundRollbackManager != null && AudioCamera != null) { var fpp = new FadePitchPan(AudioCamera.WorldToAudio(source.position)); #if DEVELOPER soundRollbackManager.PlayCue(Definitions, cue, source.position, fpp, parameters, playsLocally: true); #else soundRollbackManager.PlayCueSkipMissingCheck(Definitions, cue, source.position, fpp, parameters, playsLocally: true); #endif } }
/// <summary>Play a sound without any position (always plays centred)</summary> public void PlayCueGlobal(Cue cue, Actor source = null) // <- keeping source around, in case it is useful information (will become useful for rollback) { var parameters = PlayCueParameters.GetParameters(Definitions, cue, random, GameState.cueStates); // ^^^^ Affects gameplay || Local-only vvvv if (soundRollbackManager != null) { var fpp = new FadePitchPan(1f); #if DEVELOPER soundRollbackManager.PlayCue(Definitions, cue, null, fpp, parameters, playsLocally: true); #else soundRollbackManager.PlayCueSkipMissingCheck(Definitions, cue, null, fpp, parameters, playsLocally: true); #endif } }