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

            op.Part = category;
            playList.Add(ref op);
        }
        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));
        }
        //播放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));
        }
        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);
        }
        //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);
        }
        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();
        }
Exemple #7
0
 void AddToPlayList(SoundEffectPart category)
 {
     PlayOp op;
     op.Part = category;
     playList.Add(ref op);
 }
 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);
 }
        //播放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);

        }
Exemple #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;
        }
Exemple #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;

        }
Exemple #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();
 }