protected SoundObject(ISoundObjectParent parent, SoundEffectGame sfx) { this.parent = parent; this.soundEffectGame = sfx; this.emitter = new AudioEmitter(); this.Volume = sfx.Volume; }
protected SoundObject(ISoundObjectParent parent, SoundEffectGame sfx) { this.parent = parent; this.soundEffectGame = sfx; this.emitter = new AudioEmitter(); this.Volume = sfx.Volume; }
public AmbientLoopSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius) : base(parent, sfx) { this.lastDistance = float.MaxValue; this.radius = radius; }
/// <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); } }
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(); }
/// <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); } }
public AmbientLoopSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius) : base(parent, sfx) { this.lastDistance = float.MaxValue; this.radius = radius; }
public AmbientSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius) : base(parent, sfx) { this.radius = radius; this.Probability = sfx.Probability; }
public Normal3DSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius) : base(parent, sfx) { this.radius = radius; }
public NormalSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx) : base(parent, sfx) { this.radius = 1; }
public AmbientSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius) : base(parent, sfx) { this.radius = radius; this.Probability = sfx.Probability; }
public Normal3DSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx, float radius) : base(parent, sfx) { this.radius = radius; }
public NormalSoundObject(SoundManager sm, ISoundObjectParent parent, SoundEffectGame sfx) : base(parent, sfx) { this.radius = 1; }