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; } } }
//Stop Audio at Channel 3 void StopMusic() { MultiAudioManager.StopAudioSource(3); }