コード例 #1
0
ファイル: Sound3D.cs プロジェクト: W3SS/delta
        public static Sound3D Create(string name, Cue cue, TransformableEntity source, TransformableEntity dest, Action <string> onFinished)
        {
            Sound3D freshSound = Pool.Acquire <Sound3D>();

            freshSound.Name       = name;
            freshSound._cue       = cue;
            freshSound._source    = source;
            freshSound._dest      = dest;
            freshSound.OnFinished = onFinished;
            return(freshSound);
        }
コード例 #2
0
        public void PlayPositionalSound(string soundName, bool force, TransformableEntity source, Action <string> onFinished)
        {
            if (!_waveBank.IsPrepared || !_streamingBank.IsPrepared)
            {
                throw new InvalidOperationException("AudioManager is not prepared; update it some more.");
            }
            // play the sound if not already playing, otherwise force play another instance of the sound
            if (!IsPlaying(soundName) || force)
            {
                TransformableEntity dest       = Listener;
                Sound3D             freshSound = Sound3D.Create(soundName, _soundBank.GetCue(soundName), source, dest, onFinished);
                freshSound.Play();

                _sounds.Add(freshSound);
            }
        }