예제 #1
0
 protected SoundObject(ISoundObjectParent parent, SoundEffectGame sfx)
 {
     this.parent = parent;
     this.soundEffectGame = sfx;
     this.emitter = new AudioEmitter();
     this.Volume = sfx.Volume;
 }
예제 #2
0
 protected SoundObject(ISoundObjectParent parent, SoundEffectGame sfx)
 {
     this.parent          = parent;
     this.soundEffectGame = sfx;
     this.emitter         = new AudioEmitter();
     this.Volume          = sfx.Volume;
 }
예제 #3
0
        public AmbientLoopSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius)
            : base(parent, sfx)
        {
            this.lastDistance = float.MaxValue;

            this.radius = radius;
        }
예제 #4
0
        /// <summary>
        /// 需要提供一个service,以及音效所在文件夹的根目录
        /// </summary>
        /// <param name="service"></param>
        /// <param name="root"></param>
        private SoundManager(IServiceProvider service, string root, string xmlurl)
        {
            Service       = service;
            RootDirectory = root;
            XMLUrl        = xmlurl;
            listener      = new AudioListener();

            contentManager = new ContentManager(service, root);
            FileLocation  fl   = FileSystem.Instance.Locate(this.XMLUrl, GameFileLocs.Config);
            Configuration conf = ConfigurationManager.Instance.CreateInstance(fl);

            sfxTable = new Dictionary <string, SoundEffectGame>(conf.Count, CaseInsensitiveStringComparer.Instance);
            foreach (KeyValuePair <string, ConfigurationSection> c in conf)
            {
                ConfigurationSection sect = c.Value;
                SoundEffectGame      sfx  = new SoundEffectGame(listener, this, sect);

                sfxTable.Add(sect.Name, sfx);
            }
        }
예제 #5
0
        public SoundObject MakeSoundObjcet(string name, ISoundObjectParent parent, float r)
        {
            SoundEffectGame sfx = sfxTable[name];

            switch (sfx.Type)
            {
            case SoundType.Global:
            case SoundType.World:
                if ((sfx.Control & SoundControl.Loop) == SoundControl.Loop)
                {
                    return(new AmbientLoopSoundObject(this, parent, sfx, r));
                }
                else if ((sfx.Control & SoundControl.Ambient) == SoundControl.Ambient)
                {
                    return(new AmbientSoundObject(this, parent, sfx, r));
                }
                return(new Normal3DSoundObject(this, parent, sfx, r));

            case SoundType.Normal:
            case SoundType.Player:
                return(new NormalSoundObject(this, parent, sfx));
            }
            throw new NotSupportedException();
        }
예제 #6
0
        /// <summary>
        /// 需要提供一个service,以及音效所在文件夹的根目录
        /// </summary>
        /// <param name="service"></param>
        /// <param name="root"></param>
        private SoundManager(IServiceProvider service, string root, string xmlurl)
        {
            Service = service;
            RootDirectory = root;
            XMLUrl = xmlurl;
            listener = new AudioListener();

            contentManager = new ContentManager(service, root);
            FileLocation fl = FileSystem.Instance.Locate(this.XMLUrl, GameFileLocs.Config);
            Configuration conf = ConfigurationManager.Instance.CreateInstance(fl);

            sfxTable = new Dictionary<string, SoundEffectGame>(conf.Count, CaseInsensitiveStringComparer.Instance);
            foreach (KeyValuePair<string, ConfigurationSection> c in conf)
            {
                ConfigurationSection sect = c.Value;
                SoundEffectGame sfx = new SoundEffectGame(listener, this, sect);

                sfxTable.Add(sect.Name, sfx);
            }
        }
예제 #7
0
        public AmbientLoopSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius)
            : base(parent, sfx)
        {
            this.lastDistance = float.MaxValue;

            this.radius = radius;
        }
예제 #8
0
 public AmbientSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius)
     : base(parent, sfx)
 {
     this.radius = radius;
     this.Probability = sfx.Probability;
 }
예제 #9
0
 public Normal3DSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius)
     : base(parent, sfx)
 {
     this.radius = radius;
 }
예제 #10
0
 public NormalSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx)
     : base(parent, sfx)
 {
     this.radius = 1;
 }
예제 #11
0
 public AmbientSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius)
     : base(parent, sfx)
 {
     this.radius      = radius;
     this.Probability = sfx.Probability;
 }
예제 #12
0
 public Normal3DSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius)
     : base(parent, sfx)
 {
     this.radius = radius;
 }
예제 #13
0
 public NormalSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx)
     : base(parent, sfx)
 {
     this.radius = 1;
 }