//Plays a Persistent Audio void PlayMusic() { MultiAudioSource persistentAudio = MultiAudioManager.PlayAudioObjectByIdentifier("bgm test", 3, transform.position); //Makes the sound persistent persistentAudio.PersistsBetweenScenes = true; }
void Pickup() { //Plays a Global Audio Object via its Identifier MultiAudioManager.PlayAudioObjectByIdentifier("coin sfx", transform.position); meshRender.enabled = false; }
private void Update() { //Plays the Audio Object assigned to the Runtime Identifier "surfaceSound" if (Input.GetKeyDown(KeyCode.Space)) { MultiAudioManager.PlayAudioObjectByIdentifier("[rt]surfaceSound", transform.position); } }
//Plays an Audio Object overriting some of its parameters void PlaySoundOverrideParameters() { MultiAudioSource sound = MultiAudioManager.PlayAudioObject(refAudioObject, transform.position); //Play the audio backwards sound.PitchOverride = -1; //Change the spatial mode to 2D sound.SpatialMode2DOverride = true; }
//Fade In a Normal Music void FadeInNonPersistentMusic() { // Checks if an Multi Audio Source is playing at Channel 3 to fade in correctly the new audio without immediately stop the previous one if (MultiAudioManager.GetAudioSourceAtChannel(3) != null) { MultiAudioManager.FadeOutAudioSource(3, 1f); //Fade out previous audio MultiAudioManager.FadeInDelayedAudioObject(musicAudioObject, 1.25f, 3, transform.position, 2f); //Fade in new audio 0.25 seconds after the fade out of the previous audio } else { MultiAudioManager.FadeInAudioObject(musicAudioObject, 3, transform.position, 2f); //Fade in new audio } }
private void Update() { bool surfaceChange = false; if (Input.GetKeyDown(KeyCode.D)) { surface += 1; if (surface > 2) { surface = 0; } surfaceChange = true; } else if (Input.GetKeyDown(KeyCode.A)) { surface -= 1; if (surface < 0) { surface = 2; } surfaceChange = true; } //Assigns a different Audio Object to the Runtime Identifier "surfaceSound" when surface changes if (surfaceChange) { switch (surface) { case 1: MultiAudioManager.AssignRuntimeIdentifierAudioObject(surfaceSoundIdentifier, metalSfx); break; case 2: MultiAudioManager.AssignRuntimeIdentifierAudioObject(surfaceSoundIdentifier, waterSfx); break; default: MultiAudioManager.AssignRuntimeIdentifierAudioObject(surfaceSoundIdentifier, concreteSfx); break; } surfaceChange = false; } }
public static void PlayWithDifferentPitch(this AudioObject ao, int channel, Vector3 position, float pitchMultiplier) { MultiAudioManager.PlayAudioObject(ao, channel, position).PitchOverride = ao.pitch * pitchMultiplier; }
public static void Play(this AudioObject ao, int channel, Vector3 position, MultiAudioManager.UpdateModes updateMode) { MultiAudioSource _source = MultiAudioManager.PlayAudioObject(ao, channel, position); _source.PlayUpdateMode = updateMode; }
//Plays an Audio Object with another Audio Clip void PlayAudioObjectOverride() { MultiAudioManager.PlayAudioObjectOverride(clipForOverride, refAudioObject, transform.position); }
public static void Play(this AudioObject ao, int channel, Vector3 position) { MultiAudioManager.PlayAudioObject(ao, channel, position); }
private void Awake() { //Defines the Runtime Identifier "surfaceSound" with a default value MultiAudioManager.DefineRuntimeIdentifier(surfaceSoundIdentifier, concreteSfx); }
public static void PlayIgnoringPause(this AudioObject ao, Transform trf) { MultiAudioSource source = MultiAudioManager.PlayAudioObject(ao, trf); source.IgnoreListenerPause = true; }
//Plays a Normal Music void PlayNonPersistentMusic() { MultiAudioManager.PlayAudioObjectByIdentifier("bgm test", 3, transform.position); }
//Fade In a Normal Music void FadeInNonPersistentMusic() { MultiAudioManager.FadeInAudioObjectByIdentifier("bgm test", 3, transform.position, 2f); }
//Plays a Normal Music void PlayNonPersistentMusic() { MultiAudioManager.PlayAudioObject(musicAudioObject, 3, transform.position); }
//Plays a sound at no channel void PlayVoice() { MultiAudioManager.PlayAudioObjectByIdentifier("hello", transform.position); }
//Plays an Audio Object by its identifier void PlayAudioObjectByIdentifier() { MultiAudioManager.PlayAudioObjectByIdentifier("coin sfx", transform.position); }
public static void PlayWithDifferentPitch(this AudioObject ao, int channel, Transform targetToFollow, float pitchMultiplier) { MultiAudioManager.PlayAudioObject(ao, channel, targetToFollow).PitchOverride = ao.pitch * pitchMultiplier; }
public static void PlayIgnoringPause(this AudioObject ao, Vector3 position) { MultiAudioSource source = MultiAudioManager.PlayAudioObject(ao, position); source.IgnoreListenerPause = true; }
//Stop Audio at Channel 3 void StopMusic() { MultiAudioManager.StopAudioSource(3); }
void Update() { // Simple test movement code vel = Vector3.zero; if (Input.GetKey(inputs [0])) { vel += Vector3.forward; lastVel = vel; } if (Input.GetKey(inputs [1])) { vel += -Vector3.forward; lastVel = vel; } if (Input.GetKey(inputs [2])) { vel += Vector3.right; lastVel = vel; } if (Input.GetKey(inputs [3])) { vel += -Vector3.right; lastVel = vel; } Vector3 finalVel = (vel.normalized * speed) * Time.deltaTime; finalVel.y = 0; rb.velocity = finalVel; // Simple test rotation code if (lastVel != Vector3.zero) { transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(lastVel), Time.deltaTime * 15f); } // Change Reverb Preset inside the cave if (insideReverbZone) { listener.ReverbPreset = AudioReverbPreset.Cave; } else { listener.ReverbPreset = AudioReverbPreset.Off; } //Pause the Game if (playerId == 1 && Input.GetKeyDown("return")) { MultiAudioManager.Paused = !MultiAudioManager.Paused; if (MultiAudioManager.Paused) { MultiAudioSource pauseBgm = MultiAudioManager.PlayAudioObjectByIdentifier("pause music", 6, transform.position); pauseBgm.IgnoreListenerPause = true; pauseCanvas.SetActive(true); Time.timeScale = 0; } else { MultiAudioManager.StopAudioSource(6); pauseCanvas.SetActive(false); Time.timeScale = 1; } } }
//Fade Audio at Channel 3 void FadeOutMusic() { MultiAudioManager.FadeOutAudioSource(3, 2f); }
public static void Play(this AudioObject ao, int channel, Vector3 position, out MultiAudioSource audioSource) { audioSource = MultiAudioManager.PlayAudioObject(ao, channel, position); }
//This is the important part, the Custom Play Method public void PlayFootstep(MLPASACustomPlayMethodParameters parameters) { MultiAudioSource source = MultiAudioManager.PlayAudioObject(parameters.AudioObject, parameters.CustomParameters.IntParameter == 1?rightFoot.position:leftFoot.position); source.MasterVolume = speed; }
public static void Play(this AudioObject ao, int channel, Transform targetToFollow) { MultiAudioManager.PlayAudioObject(ao, channel, targetToFollow); }
//Plays an Audio Object void PlayAudioObject() { MultiAudioManager.PlayAudioObject(refAudioObject, transform.position); }
public static void Play(this AudioObject ao, int channel, Transform targetToFollow, out MultiAudioSource audioSource) { audioSource = MultiAudioManager.PlayAudioObject(ao, channel, targetToFollow); }
void Awake() { //Plays an occludable Audio Object by its identifier and makes that follows the position of this GameObject MultiAudioManager.PlayAudioObjectByIdentifier("bgm test", transform, true); }
public static void Play(this AudioObject ao, Transform targetToFollow, MultiAudioManager.UpdateModes updateMode) { MultiAudioSource _source = MultiAudioManager.PlayAudioObject(ao, targetToFollow); _source.PlayUpdateMode = updateMode; }
void Awake() { //Plays an occludable Audio Object and makes that follows the position of this GameObject MultiAudioManager.PlayAudioObject(bgm, transform, true); }