XNA音效

马里士

我的音效有点问题。它不能正常运行,因为当我播放时,它在两秒钟内播放了约500000次。看一下这里:

SoundEffect thunder;
thunter=Content.Load<SoundEffect>("thunder");

foreach (flash flash in flashes)
   if(flash.visible==true)
       if (time >1 && time <3)
            thunder.Play(); //now it sounds bad because it is played a lot of times.. I want it to be played only once! (the sound is 5 sec long)
辛纳特

可以这么简单吗:

foreach (var flash in flashes)
   if (flash.visible && time > 1 && time < 3)
   {
        thunder.Play();
        break; // play sound only once
   }

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章