void Pickup() { //Plays a Global Audio Object via its Identifier MultiAudioManager.PlayAudioObjectByIdentifier("coin sfx", transform.position); meshRender.enabled = false; }
//Plays a Persistent Audio void PlayMusic() { MultiAudioSource persistentAudio = MultiAudioManager.PlayAudioObjectByIdentifier("bgm test", 3, transform.position); //Makes the sound persistent persistentAudio.PersistsBetweenScenes = true; }
private void Update() { //Plays the Audio Object assigned to the Runtime Identifier "surfaceSound" if (Input.GetKeyDown(KeyCode.Space)) { MultiAudioManager.PlayAudioObjectByIdentifier("[rt]surfaceSound", transform.position); } }
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; } } }
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); }
//Plays a Normal Music void PlayNonPersistentMusic() { MultiAudioManager.PlayAudioObjectByIdentifier("bgm test", 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); }