コード例 #1
0
ファイル: XleGameControl.cs プロジェクト: eylvisaker/Xle
        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));
        }
コード例 #2
0
ファイル: XleGameControl.cs プロジェクト: eylvisaker/Xle
        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;
                }
            }
        }
コード例 #3
0
ファイル: XleGameControl.cs プロジェクト: eylvisaker/Xle
 public static Task PlaySoundSync(this IXleGameControl gameControl, LotaSound sound) => gameControl.PlaySoundWait(sound);
コード例 #4
0
ファイル: XleGameControl.cs プロジェクト: eylvisaker/Xle
 public void PlaySound(LotaSound lotaSound, float volume = 1)
 {
     soundMan.PlaySound(lotaSound, volume);
 }
コード例 #5
0
ファイル: StoreExtender.cs プロジェクト: eylvisaker/Xle
 protected Task StoreSound(LotaSound sound) => GameControl.PlaySoundWait(sound);