XNA sound effect
本文关键字:effect sound XNA | 更新日期: 2023-09-27 18:06:07
我有一个小问题的声音效果。它不能很好地运行,因为当我在两秒钟内播放大约50万次。看看这里:
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
}