标签:unity3d培训 unity3d游戏 unity培训 3d游戏开发 unity3d学习
public void playSoundEffect(SoundEffects soundEffect)
{
AudioClip clip = null;
float pitch = 1;
switch (soundEffect) {
case SoundEffects.ObstacleCollisionSoundEffect:
clip = obstacleCollision;
break;
case SoundEffects.CoinSoundEffect:
clip = coinCollection;
pitch = 1.5f;
break;
case SoundEffects.PowerUpSoundEffect:
clip = powerUpCollection;
break;
case SoundEffects.GameOverSoundEffect:
clip = gameOver;
break;
case SoundEffects.GUITapSoundEffect:
clip = guiTap;
break;
}
soundEffectsAudio.pitch = pitch;//音调
soundEffectsAudio.clip = clip;//
soundEffectsAudio.Play();
}
声明:此篇文档时来自于【狗刨学习网】社区-unity极致学院,是网友自行发布的Unity3D学习文章,如果有什么内容侵犯了你的相关权益,请与官方沟通,我们会即时处理。
标签:unity3d培训 unity3d游戏 unity培训 3d游戏开发 unity3d学习
原文地址:http://blog.csdn.net/book_longssl/article/details/44113853