コード例 #1
0
 public void StopMusic()
 {
     if (m_MusicCurrentlyPlaying != null)
     {
         m_MusicCurrentlyPlaying.Stop();
         m_MusicCurrentlyPlaying.Dispose();
         m_MusicCurrentlyPlaying = null;
     }
 }
コード例 #2
0
        /// <summary>
        /// Constructor method for sounds
        /// </summary>
        /// <param name="activebuffer"></param>
        /// <param name="filename"></param>
        ///

        /* public SystemAudio(string filename)
         * {
         *    AC = new AudioContext();
         * }*/

        public void OnAction(Entity entity)
        {
            if ((entity.Mask & MASK) == MASK)
            {
                List <IComponent> components = entity.Components;

                IComponent emitterComponent = components.Find(delegate(IComponent component)
                {
                    return(component.ComponentType == ComponentTypes.COMPONENT_AUDIOEMITTER);
                });

                ASound emit = ((ComponentAudioEmitter)emitterComponent).GetSound();

                AL.Source(emit.source, ALSourcei.Buffer, emit.buffer); // attach the buffer to a source
                AL.Source(emit.source, ALSourceb.Looping, false);
                AL.Source(emit.source, ALSource3f.Position, ref emit.emitPos);
            }
        }
コード例 #3
0
        public void PlayMusic(int id)
        {
            if (Settings.Audio.MusicOn)
            {
                if (id < 0) // not a valid id, used to stop music.
                {
                    StopMusic();
                    return;
                }

                if (!m_Music.ContainsKey(id))
                {
                    string name;
                    bool   loops;
                    if (MusicData.TryGetMusicData(id, out name, out loops))
                    {
                        m_Music.Add(id, new UOMusic(id, name, loops));
                    }
                    else
                    {
                        Tracer.Error("Received unknown music id {0}", id);
                        return;
                    }
                }

                ASound toPlay = m_Music[id];
                if (toPlay != m_MusicCurrentlyPlaying)
                {
                    // stop the current song
                    StopMusic();
                    // play the new song!
                    m_MusicCurrentlyPlaying = toPlay;
                    m_MusicCurrentlyPlaying.Play(false);
                }
            }
        }
コード例 #4
0
ファイル: Wolf.cs プロジェクト: banana-party/Animals
 //Метод можно было реализовать лучше
 public override void MakeASound()
 {
     ASound.MakeASound();
 }