public static SoundEffectRegistry instance() { if (soundEffectRegistry == null) { soundEffectRegistry = FindObjectOfType(typeof(SoundEffectRegistry)) as SoundEffectRegistry; } // If it is still null, create a new instance if (soundEffectRegistry == null) { GameObject obj = new GameObject("SoundEffectRegistry"); soundEffectRegistry = obj.AddComponent(typeof(SoundEffectRegistry)) as SoundEffectRegistry; } return(soundEffectRegistry); }
public void PlaySound(PhysicMaterial materialObject, PhysicMaterial contactObject, float intensity) { PlaySound(SoundEffectRegistry.instance().GetSoundCombination(materialObject.name, contactObject.name), intensity); }