private void FixedUpdate() { Vector3 velocity = _rigidbody.velocity; if (Math.Abs(velocity.x) > minVelocity && xIsActive) { OnMovement(); } else if (Math.Abs(velocity.y) > minVelocity && yIsActive) { OnMovement(); } else if (Math.Abs(velocity.z) > minVelocity && zIsActive) { OnMovement(); } else { _movementSource.Stop(); } }
/// <summary> /// Stops the current clip in the audio source. /// </summary> public void Stop() { _audioSource.Stop(); }
/// <summary> /// Stops all sound regarding movement. /// </summary> public void StopMovement() { _movementSources.Stop(); }