Click or drag to resize

AudioSourceExtSafePlayCollision Method

Convenience wrapper around SafePlay(AudioSource, AudioClip, Single, Single, Boolean) for collision sounds.

Namespace:  RavingBots.MagicGestures.Utils
Assembly:  Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
C#
public static void SafePlayCollision(
	this AudioSource audioSource,
	AudioClip clip,
	float velocity,
	float minVelocity,
	float velocityToVolume,
	float pitch = 1f
)

Parameters

audioSource
Type: AudioSource
clip
Type: AudioClip
velocity
Type: SystemSingle
minVelocity
Type: SystemSingle
velocityToVolume
Type: SystemSingle
pitch (Optional)
Type: SystemSingle

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type AudioSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
This method ensures collision sounds are only played when collision velocity is sufficient, and also scales the volume based on the velocity.
See Also