本文整理汇总了C#中SoundType类的典型用法代码示例。如果您正苦于以下问题:C# SoundType类的具体用法?C# SoundType怎么用?C# SoundType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SoundType类属于命名空间,在下文中一共展示了SoundType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
}
示例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;
}
}
示例4: SmackerAudioTrack
public SmackerAudioTrack(IMixer mixer, AudioInfo audioInfo, SoundType soundType)
{
Mixer = mixer;
_audioInfo = audioInfo;
SoundType = soundType;
_audioStream = new QueuingAudioStream((int)_audioInfo.sampleRate, _audioInfo.isStereo);
}
示例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();
}
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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);
}
示例14: PlayEffect
public void PlayEffect(SoundType Type)
{
SoundEffect sound = GetSoundEffect(Type);
if (sound != null)
{
sound.Play();
}
}
示例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);
}