示例#1
0
        void AddToPlayList(SoundEffectPart category)
        {
            PlayOp op;

            op.Part = category;
            playList.Add(ref op);
        }
示例#2
0
        public SoundEffectInstance Play3D(SoundEffectPart category, AudioEmitter emitter, float volume, float pitch, bool loop)
        {
            int idx = 0;

            if ((Control & SoundControl.Random) == SoundControl.Random)
            {
                idx = Randomizer.GetRandomInt(soundEffects[(int)category].Length);
            }
            return(Play(soundEffects[(int)category][idx], emitter, volume * Volume, pitch, loop));
        }
示例#3
0
        //播放3D声音


        public SoundEffectInstance Play3D(SoundEffectPart category, AudioEmitter emitter)
        {
            int idx = 0;

            if ((Control & SoundControl.Random) == SoundControl.Random)
            {
                idx = Randomizer.GetRandomInt(soundEffects[(int)category].Length);
            }
            return(Play(soundEffects[(int)category][idx], emitter));
        }
示例#4
0
        public SoundEffectInstance Play(SoundEffectPart category, float volume)
        {
            int idx = 0;

            if ((Control & SoundControl.Random) == SoundControl.Random)
            {
                idx = Randomizer.GetRandomInt(soundEffects[(int)category].Length);
            }
            SoundEffectInstance inst = soundEffects[(int)category][idx].CreateInstance();//.Play(volume * Volume, 0, 0);

            inst.Volume = volume * Volume;
            inst.Play();
            return(inst);
        }
示例#5
0
        //pitch,pan(-1左声道,1右声道)默认值设为0;
        public SoundEffectInstance Play(SoundEffectPart category, float volume, float pitch, float pan, bool isLoop)
        {
            int idx = 0;

            if ((Control & SoundControl.Random) == SoundControl.Random)
            {
                idx = Randomizer.GetRandomInt(soundEffects[(int)category].Length);
            }
            SoundEffectInstance inst = soundEffects[(int)category][idx].CreateInstance();

            inst.Volume   = volume;
            inst.Pitch    = pitch;
            inst.Pan      = pan;
            inst.IsLooped = isLoop;
            inst.Play();

            //return soundEffects[(int)category][idx].Play(volume * Volume, pitch, pan, isLoop);
            return(inst);
        }
示例#6
0
        public SoundEffectInstance Play(SoundEffectPart category, SoundObject soundObj)
        {
            switch (Type)
            {
            case SoundType.Normal:
                return(Play(category, soundObj.Volume));

            case SoundType.Player:
                if (soundObj.Parent.IsLocalHumanPlayer)
                {
                    return(Play(category, soundObj.Volume));
                }
                return(null);

            case SoundType.Global:
            case SoundType.World:
                return(Play3D(category, soundObj.Emitter));
            }
            throw new NotSupportedException();
        }
示例#7
0
 void AddToPlayList(SoundEffectPart category)
 {
     PlayOp op;
     op.Part = category;
     playList.Add(ref op);
 }
示例#8
0
 public SoundEffectInstance Play3D(SoundEffectPart category, AudioEmitter emitter, float volume, float pitch, bool loop)
 {
     int idx = 0;
     if ((Control & SoundControl.Random) == SoundControl.Random)
     {
         idx = Randomizer.GetRandomInt(soundEffects[(int)category].Length);
     }
     return Play(soundEffects[(int)category][idx], emitter, volume * Volume, pitch, loop);
 }
示例#9
0
        //播放3D声音


        public SoundEffectInstance Play3D(SoundEffectPart category, AudioEmitter emitter)
        {
            int idx = 0;
            if ((Control & SoundControl.Random) == SoundControl.Random)
            {
                idx = Randomizer.GetRandomInt(soundEffects[(int)category].Length);
            }
            return Play(soundEffects[(int)category][idx], emitter);

        }
示例#10
0
        //pitch,pan(-1左声道,1右声道)默认值设为0;
        public SoundEffectInstance Play(SoundEffectPart category, float volume, float pitch, float pan, bool isLoop)
        {

            int idx = 0;
            if ((Control & SoundControl.Random) == SoundControl.Random)
            {
                idx = Randomizer.GetRandomInt(soundEffects[(int)category].Length);
            }
            SoundEffectInstance inst = soundEffects[(int)category][idx].CreateInstance();
            inst.Volume = volume;
            inst.Pitch = pitch;
            inst.Pan = pan;
            inst.IsLooped = isLoop;
            inst.Play();

            //return soundEffects[(int)category][idx].Play(volume * Volume, pitch, pan, isLoop);
            return inst;
        }
示例#11
0
        public SoundEffectInstance Play(SoundEffectPart category, float volume)
        {

            int idx = 0;
            if ((Control & SoundControl.Random) == SoundControl.Random)
            {
                idx = Randomizer.GetRandomInt(soundEffects[(int)category].Length);
            }
            SoundEffectInstance inst = soundEffects[(int)category][idx].CreateInstance();//.Play(volume * Volume, 0, 0);
            inst.Volume = volume * Volume;
            inst.Play();
            return inst;

        }
示例#12
0
 public SoundEffectInstance Play(SoundEffectPart category, SoundObject soundObj)
 {
     switch (Type)
     {
         case SoundType.Normal:
             return Play(category, soundObj.Volume);
         case SoundType.Player:
             if (soundObj.Parent.IsLocalHumanPlayer)
             {
                 return Play(category, soundObj.Volume);
             }
             return null;
         case SoundType.Global:
         case SoundType.World:
             return Play3D(category, soundObj.Emitter);
     }
     throw new NotSupportedException();
 }