• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SoundType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SoundType的典型用法代码示例。如果您正苦于以下问题:C# SoundType类的具体用法?C# SoundType怎么用?C# SoundType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SoundType类属于命名空间,在下文中一共展示了SoundType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: MissleSystem2D

 public MissleSystem2D(List<Collidable> collidableList, CollidableType type, float radius, SoundType soundType, Texture2D weaponTexture, float scale, GraphicsDevice device, int maxBullets,
     Vector3 weaponPositionRelative, float coolDownMS, float weaponSpeed, float bulletSpreadIntensity, int amountMissles, int life)
     : base(collidableList, type, radius, soundType, weaponTexture, scale, device, maxBullets, weaponPositionRelative, coolDownMS, weaponSpeed, bulletSpreadIntensity)
 {
     AmountMissles = amountMissles;
     _life = life;
 }
开发者ID:robertg,项目名称:Soar,代码行数:7,代码来源:MissleSystem2D.cs


示例2: PlayEffect

 public void PlayEffect(SoundType id)
 {
     // plays an audio clip after its id
     switch(id){
     case SoundType.onClick:
         if( onButtonPress != null)	audio.PlayOneShot(onButtonPress,effectVolume);
         break;
     case SoundType.error:
         if( onError != null)	audio.PlayOneShot(onError, effectVolume);
         break;
     case SoundType.undo:
         if( onUndo != null)		audio.PlayOneShot(onUndo, effectVolume);
         break;
     case SoundType.build:
         if( onBuild != null)	audio.PlayOneShot(onBuild, effectVolume);
         break;
     case SoundType.shoot:
         if( onShoot != null)	audio.PlayOneShot(onShoot, effectVolume);
         break;
     case SoundType.silence:
         if( onSilence != null)	audio.PlayOneShot(onSilence, effectVolume);
         break;
     case SoundType.newTower:
         if( onNewTower != null)	audio.PlayOneShot(onNewTower,effectVolume);
         break;
     case SoundType.victory:
         if( onVictory != null)	audio.PlayOneShot(onVictory, effectVolume);
         break;
     case SoundType.defeat:
         if( onDefeat != null)	audio.PlayOneShot(onDefeat, effectVolume);
         break;
     }
 }
开发者ID:PxcL,项目名称:Unity_Tic-Tac-Tower,代码行数:33,代码来源:Sound.cs


示例3: SoundInstance

        public SoundInstance(ScriptEngine parent, string filename)
            : base(parent)
        {
            PopulateFunctions();

            string[] sounds = { ".wav", ".flac" };
            string[] music = { ".ogg" };

            if (!System.IO.File.Exists(filename)) {
                _soundType = SoundType.None;
                return;
            }

            _filename = filename;
            string ending = System.IO.Path.GetExtension(filename);
            if (Array.Exists(sounds, x => x == ending))
            {
                _sound = new Sound(new SoundBuffer(filename));
                _soundType = SoundType.Sound;
            }
            else if (Array.Exists(music, x => x == ending))
            {
                _music = new Music(filename);
                _soundType = SoundType.Music;
            }
        }
开发者ID:Radnen,项目名称:sphere-sfml,代码行数:26,代码来源:SoundInstance.cs


示例4: SmackerAudioTrack

 public SmackerAudioTrack(IMixer mixer, AudioInfo audioInfo, SoundType soundType)
 {
     Mixer = mixer;
     _audioInfo = audioInfo;
     SoundType = soundType;
     _audioStream = new QueuingAudioStream((int)_audioInfo.sampleRate, _audioInfo.isStereo);
 }
开发者ID:scemino,项目名称:nscumm,代码行数:7,代码来源:SmackerAudioTrack.cs


示例5: Play

        public static void Play(SoundType type)
        {
            if (Environment.OSVersion.Platform == PlatformID.Unix) return;
            if (type != SoundType.None) {
                Stream sound;
                switch (type) {
                    case SoundType.Click:
                        sound = Sounds.scificlick;
                        break;
                    case SoundType.Servo:
                        sound = Sounds.panel_move;
                        break;
                    case SoundType.BigClick:
                        sound = Sounds.button_click;
                        break;
                    default:
                        sound = null;
                        break;
                }


                if (sound != null) {
                    var sp = new SoundPlayer(sound);
                    sp.Play();
                }
            }
        }
开发者ID:DeinFreund,项目名称:Zero-K-Infrastructure,代码行数:27,代码来源:SoundPalette.cs


示例6: PlaySound

	public void PlaySound(SoundType type, Transform position) {
        switch (type) {
            case SoundType.Rustle:
                rustleManager.PlaySound(position);
                break;
            case SoundType.ShortRustle:
                shortRustleManager.PlaySound(position);
                break;
            case SoundType.Creak:
                creakManager.PlaySound(position);
                longRustleManager.PlaySound(position);
                break;
            case SoundType.Whale:
                whaleManager.PlaySound(position);
                break;
            case SoundType.Bird:
                birdManager.PlaySound(position);
                break;
            case SoundType.BirdSqueak:
                birdSqueakManager.PlaySound(position);
                break;
            default:
                Debug.LogError("Unexpected sound type: " + type);
                break;
        }
    }
开发者ID:jwinder86,项目名称:GJGDCJam,代码行数:26,代码来源:SoundManager.cs


示例7: CheckSoundSolid

 bool CheckSoundSolid( byte b )
 {
     SoundType newType = game.BlockInfo.StepSounds[b];
     if( newType != SoundType.None ) sndType = newType;
     if( b != 0 ) anyNonAir = true;
     return false;
 }
开发者ID:Chameleonherman,项目名称:ClassicalSharp,代码行数:7,代码来源:SoundComponent.cs


示例8: FighterController

 /// <summary>
 /// Instantiate a new fighter controller
 /// </summary>
 /// <param name="state">The fighter state (enemy, player, wingman...)</param>
 /// <param name="trailPositions">List of trails position</param>
 /// <param name="engineAudio">Engine audio type</param>
 /// <param name="shootAudio">Gun shoot audio type</param>
 public FighterController(FighterState state, List<Vector3> trailPositions, SoundType engineAudio, SoundType shootAudio)
 {
     this.state = state;
     this.trailPositions = trailPositions;
     this.engineAudio = engineAudio;
     this.shootAudio = shootAudio;
 }
开发者ID:seraph526,项目名称:Samples,代码行数:14,代码来源:FighterController.cs


示例9: WeaponSystem2D

        public WeaponSystem2D(List<Collidable> collidableRef, CollidableType type, float radius, SoundType soundType, Texture2D weaponTexture, float scale, GraphicsDevice device, int maxBullets,  Vector3 weaponPositionRelative, float coolDownMS, float weaponSpeed, float bulletSpreadIntensity)
        {
            CollidableReference = collidableRef;
            _projectileList = new List<Projectile>();
            _weaponPositionRelative = weaponPositionRelative;
            _coolDownMS = coolDownMS;
            _weaponSpeed = weaponSpeed;
            _timer = 0;
            _randomVar = new Random();
            _device = device;
            _textureQuad = new TextureQuad(_device, weaponTexture, scale, scale);

            _weaponTexture = weaponTexture;
            _scale = scale;

            _spriteBatch = new SpriteBatch(_device);
            _basicEffect = new BasicEffect(_device);

            _bulletSpreadIntensity = bulletSpreadIntensity;

            _maxBullets = maxBullets;

            _type = type;
            _boundingRadius = radius;

            _soundDump = new List<Sound>();
            _soundType = soundType;
        }
开发者ID:robertg,项目名称:Soar,代码行数:28,代码来源:WeaponSystem2D.cs


示例10: playSFX

 public static void playSFX(SoundType type)
 {
     //Thread soundThread = new Thread(playSound);
     switch (type)
     {
         case SoundType.Click:
             playSound("GUI/Sounds/click.wav");
             //soundThread.Start(@"C:\Users\Team7\Documents\crash.wav");
             break;
         case SoundType.MouseOver:
             playSound("GUI/Sounds/swish.wav");
             //soundThread.Start(@"C:\Users\Team7\Documents\swish.wav");
             break;
         case SoundType.Move:
             // Play move sound
             break;
         case SoundType.KeyDown:
             playSound("GUI/Sounds/typewriter.wav");
             break;
         case SoundType.Rotate:
             playSound("GUI/Sounds/swish.wav");
             break;
         default:
             //playSound(@"C:\Users\Team7\Documents\Windows Notify.wav");
             break;
     }
 }
开发者ID:Bang-Bang-Studios,项目名称:Integration,代码行数:27,代码来源:SoundManager.cs


示例11: GetSoundPath

        /// <summary>
        /// Gets sound path by its sound type
        /// </summary>
        /// <param name="sound"></param>
        /// <returns></returns>
        public string GetSoundPath(SoundType sound)
        {
            var list = this.soundDictionary[sound];
            int id = this.random.NextInt() % list.Length;
            var soundInfo = list[id];

            return soundInfo.Path;
        }
开发者ID:WaveEngine,项目名称:Samples,代码行数:13,代码来源:SoundManager.cs


示例12: SetSound

 void SetSound( int count, SoundType digType, SoundType stepType )
 {
     for( int i = 0; i < count; i++ ) {
         StepSounds[i + curSoundBlock] = stepType;
         DigSounds[i + curSoundBlock] = digType;
     }
     curSoundBlock += count;
 }
开发者ID:Chameleonherman,项目名称:ClassicalSharp,代码行数:8,代码来源:BlockInfo.Sounds.cs


示例13: PlaySound

		public override void PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type)
		{
			soundInstance = sound.CreateInstance();
			soundInstance.Volume = volume * .5f;
			soundInstance.Pan = pan;
			soundInstance.Pitch = -1.0f;
			Main.PlaySoundInstance(soundInstance);
		}
开发者ID:DrakoGlyph,项目名称:tModLoader,代码行数:8,代码来源:Wooo.cs


示例14: PlayEffect

 public void PlayEffect(SoundType Type)
 {
     SoundEffect sound = GetSoundEffect(Type);
     if (sound != null)
     {
         sound.Play();
     }
 }
开发者ID:la222tc,项目名称:1dv437_Project,代码行数:8,代码来源:Sounds.cs


示例15: Play

        /// <summary>
        /// Play a sound and return its instance
        /// </summary>
        /// <param name="sound">The sound type</param>
        /// <param name="loop">Indicate if the sound must be looped</param>
        /// <returns>The associated sound instance</returns>
        public SoundInstance Play(SoundType sound, bool loop = false)
        {
            var list = this.soundDictionary[sound];
            int id = this.random.NextInt() % list.Length;
            var soundInfo = list[id];

            return this.soundPlayer.Play(soundInfo, 0, loop);
        }
开发者ID:seraph526,项目名称:Samples,代码行数:14,代码来源:SoundManager.cs


示例16: SoundProcess

 public SoundProcess(Resource resource, SoundType type, int volume, bool looping)
 {
     _soundResource = resource;
     _volume = volume;
     _isLooping = looping;
     AudioType = type;
     InitializeVolume();
 }
开发者ID:makesj,项目名称:vienna,代码行数:8,代码来源:SoundProcess.cs


示例17: GetAudioClip

	public AudioClip GetAudioClip(SoundType type){
		switch(type){
			case SoundType.NormalBtnSound:
				return normalBtnClick;
		}
		Debug.LogError("[SoundManager] cannot get the audioclip by the type");
		return null;
	}
开发者ID:TrojanFighter,项目名称:U3D-DesignerBehaviorTest1,代码行数:8,代码来源:SoundManager.cs


示例18: GetSoundEffect

 private SoundEffect GetSoundEffect(SoundType Type)
 {
     if (!_effects.ContainsKey(Type))
         using (FileStream fs = File.Open((string.Format("Content\\{0}.wav", Type)), FileMode.Open))
         {
             _effects.Add(Type, SoundEffect.FromStream(fs));
         }
     return _effects[Type];
 }
开发者ID:la222tc,项目名称:1dv437_Project,代码行数:9,代码来源:Sounds.cs


示例19: PlaySound

		public override void PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type)
		{
			if (soundInstance.State == SoundState.Playing)
				return;
			soundInstance.Volume = volume * .5f;
			soundInstance.Pan = pan;
			soundInstance.Pitch = (float)Main.rand.Next(-5, 6) * .05f;
			Main.PlaySoundInstance(soundInstance);
		}
开发者ID:DrakoGlyph,项目名称:tModLoader,代码行数:9,代码来源:WatchOut.cs


示例20: PickRandomSound

        public Sound PickRandomSound( SoundType type )
        {
            if( type == SoundType.None )  return null;
            string name = soundNames[(int)type];

            List<Sound> sounds;
            if( !allSounds.TryGetValue( name, out sounds ) ) return null;
            return sounds[rnd.Next( sounds.Count )];
        }
开发者ID:Chameleonherman,项目名称:ClassicalSharp,代码行数:9,代码来源:Soundboard.cs



注:本文中的SoundType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Source类代码示例发布时间:2022-05-24
下一篇:
C# SoundState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap