public async Task PlayMagicSound(LotaSound sound, LotaSound endSound, int distance) { if (distance <= 0) { throw new ArgumentOutOfRangeException("distance", "Distance must be greater than zero."); } soundMan.PlaySound(sound); await WaitAsync(250 *distance + 450 *(distance - 1)); soundMan.StopSound(sound); soundMan.PlaySound(endSound, MathF.Pow(distance, -0.5f)); }
public async Task PlaySoundWait(LotaSound lotaSound, float maxTime_ms = 15000) { soundMan.PlaySound(lotaSound); await WaitAsync(150); int time = 0; while (soundMan.IsPlaying(lotaSound)) { Debug.WriteLine($"Waiting for sound {lotaSound}... {time}"); await WaitAsync(50); time += 50; if (time > maxTime_ms) { break; } } }
public static Task PlaySoundSync(this IXleGameControl gameControl, LotaSound sound) => gameControl.PlaySoundWait(sound);
public void PlaySound(LotaSound lotaSound, float volume = 1) { soundMan.PlaySound(lotaSound, volume); }
protected Task StoreSound(LotaSound sound) => GameControl.PlaySoundWait(sound);