예제 #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);
            }
        }