Beispiel #1
0
        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));
        }
Beispiel #2
0
        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;
                }
            }
        }
Beispiel #3
0
 public static Task PlaySoundSync(this IXleGameControl gameControl, LotaSound sound) => gameControl.PlaySoundWait(sound);
Beispiel #4
0
 public void PlaySound(LotaSound lotaSound, float volume = 1)
 {
     soundMan.PlaySound(lotaSound, volume);
 }
Beispiel #5
0
 protected Task StoreSound(LotaSound sound) => GameControl.PlaySoundWait(sound);