本文整理汇总了C#中Microsoft.Xna.Framework.Audio.SoundEffectInstance.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# SoundEffectInstance.Stop方法的具体用法?C# SoundEffectInstance.Stop怎么用?C# SoundEffectInstance.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Audio.SoundEffectInstance
的用法示例。
在下文中一共展示了SoundEffectInstance.Stop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadAudio
public void LoadAudio( SoundEffect selectPiece, SoundEffect unMove,
SoundEffect aMove, SoundEffect convert)
{
this.selectPiece = selectPiece;
this.unMove = unMove;
this.aMove = aMove;
this.convert = convert;
seiConvert = convert.Play(1.0f, 0.0f, 0.0f, false);
seiConvert.Stop();
seiAvaMove = aMove.Play(1.0f, 0.0f, 0.0f, false);
seiAvaMove.Stop();
}
示例2: StopSoundEffect
/// <summary>
///
/// </summary>
/// <param name="se"></param>
public void StopSoundEffect(SoundEffectInstance se)
{
se.Stop();
this.ActiveSoundEffects.Remove(se);
}
示例3: StopSoundEffect
/// <summary>
/// Stop a looped soundeffect.
/// </summary>
/// <param name="instance">The sound you want to stop.</param>
private void StopSoundEffect(SoundEffectInstance instance)
{
if (instance.IsLooped) {
instance.Stop();
instance.IsLooped = false;
}
}
示例4: StopSfx
public static void StopSfx(SoundEffectInstance soundCue)
{
soundCue.Stop(true);
soundCue.Dispose();
}
示例5: CollectDrug
void CollectDrug()
{
DrugsCount++;
switch (DrugsCount)
{
case 1: // change props
foreach (var tileset in map.Tilesets)
{
if (tileset.Name == "propsit")
{
tileset.Texture = PropsTileSheetDark;
}
}
break;
case 2: // change enemies
instance.Stop(true);
instance = Musa2.CreateInstance();
instance.IsLooped = true;
instance.Volume = volume;
instance.Play();
break;
case 3: // change player
instance.Stop(true);
instance = Musa3.CreateInstance();
instance.IsLooped = true;
instance.Volume = volume;
instance.Play();
player.ChangeTexture(PlayerTextureDark);
break;
case 4: // change maptextures
instance.Stop(true);
instance = Musa4.CreateInstance();
instance.IsLooped = true;
instance.Volume = volume;
instance.Play();
foreach (var enemy in enemies)
{
if (enemy.Type == Enemy.EnemyType.Nurse)
{
enemy.ChangeTexture(NurseTextureDark);
}
else
{
enemy.ChangeTexture(DoctorTextureDark);
}
}
foreach (var tileset in map.Tilesets)
{
if (tileset.Name == "tilesetti3")
{
tileset.Texture = WorldTileSheetDark;
}
}
break;
case 5: // win game
Reset();
Data.GameState = State.End;
break;
default:
foreach (var tileset in map.Tilesets)
{
if (tileset.Name == "propsit")
{
tileset.Texture = PropsTileSheet;
}
}
foreach (var enemy in enemies)
{
if (enemy.Type == Enemy.EnemyType.Nurse)
{
enemy.ChangeTexture(NurseTexture);
}
else
{
enemy.ChangeTexture(DoctorTexture);
}
}
player.ChangeTexture(PlayerTexture);
foreach (var tileset in map.Tilesets)
{
if (tileset.Name == "tilesetti3")
{
tileset.Texture = WorldTileSheet;
}
}
break;
}
}
示例6: play3dSound
public void play3dSound(SoundEffectInstance sound, Vector3 soundPos)
{
AudioListener listener = new AudioListener();
listener.Position = game.ship.pos;
AudioEmitter emitter = new AudioEmitter();
emitter.Position = soundPos;
//sound.Apply3D(listener, emitter); throws An unhandled exception of type 'System.AccessViolationException' occurred in SharpDX.XAudio2.dll
sound.Stop();
sound.Play();
}
示例7: SetBacgroundMusic
public void SetBacgroundMusic(ContentManager content, string source, float volume)
{
if (Constants.Music && !string.IsNullOrEmpty(source))
{
if (backgroundMusic != null) backgroundMusic.Stop();
toVolume = volume;
backgroundMusic = getSound(content, source);
backgroundMusic.Stop();
//backgroundMusic.IsLooped = true;
backgroundMusic.Volume = 0f;
backgroundMusic.Play();
}
}
示例8: StopEffect
public static void StopEffect(SoundEffectInstance soundEffectInstance)
{
if (soundEffectInstance != null)
{
soundEffectInstance.Stop();
soundEffects.Remove(soundEffectInstance);
}
}
示例9: LoadContent
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
// Create a music track
soundtrack = Content.Load<SoundEffect>("Behind-every-Idea");
music = soundtrack.CreateInstance();
playergun = Content.Load<SoundEffect>("starting_pistol");
zombiehit = Content.Load<SoundEffect>("Zombie Attacked");
playerhit = Content.Load<SoundEffect>("Bite");
//Make the track looped and if its stop then play it
music.IsLooped = true;
music.Volume = 0.75f;
if (music.State == SoundState.Playing) music.Stop();
// TODO: use this.Content to load your game content here
mainfont = Content.Load<SpriteFont>("quartz4"); // Load the quartz4 font
background = new graphic2d(Content, "ZombieBG", displaywidth, displayheight);
background2 = new graphic2d(Content, "skyline", displaywidth, displayheight);
backgroundGO = new graphic2d(Content, "gameoverbg", displaywidth, displayheight);
up = new sprite2d(Content, "up", 115, displayheight - 150, 0.25f, Color.White, true);
down = new sprite2d(Content, "down",115, displayheight - 50, 0.25f, Color.White, true);
left = new sprite2d(Content, "left", 55, displayheight - 100, 0.25f, Color.White, true);
right = new sprite2d(Content, "right", 175, displayheight - 100, 0.25f, Color.White, true);
controlshowto = new sprite2d(Content, "Controls", 425, displayheight - 225, 0.65f, Color.White, true);
firebut = new sprite2d(Content, "fire", 700, displayheight - 100, 0.50f, Color.White, true);
menuback = new sprite2d(Content, "right", displaywidth - 50, 50, 0.25f, Color.White, true);
menuoptions[0] = new sprite2d(Content, "buttonstart", displaywidth / 2, 150, 0.50f, Color.White, true);
menuoptions[1] = new sprite2d(Content, "buttonhowtoplay", displaywidth / 2, 220, 0.50f, Color.White, true);
menuoptions[2] = new sprite2d(Content, "buttonhighscore", displaywidth / 2, 290, 0.50f, Color.White, true);
menuoptions[3] = new sprite2d(Content, "buttonexit", displaywidth / 2, 360, 0.50f, Color.White, true);
// Initialise robot1 object
playerchar = new model3d(Content, "player", 2f, new Vector3(0, 0, 0), new Vector3(0, 0, 0), 0.002f, 0.06f, 10);
playerchar.bboxsize = new Vector3(25, 115, 25);
// Load High Scores in
using (IsolatedStorageFile savegamestorage = IsolatedStorageFile.GetUserStoreForApplication())
{
if (savegamestorage.FileExists("highscores.txt"))
{
using (IsolatedStorageFileStream fs = savegamestorage.OpenFile("highscores.txt", System.IO.FileMode.Open))
{
using (StreamReader sr = new StreamReader(fs))
{
string line;
for (int i = 0; i < numberofhighscores; i++)
{
line = sr.ReadLine();
highscores[i] = Convert.ToInt32(line);
}
sr.Close();
}
}
}
}
// Sort high scores
Array.Sort(highscores);
Array.Reverse(highscores);
}
示例10: StopSoundMem
/* */
void StopSoundMem(SoundEffectInstance paramSoundEffect)
{
try { paramSoundEffect.Stop(); } catch (Exception localException) {
/* */ }
}
示例11: Load
public override void Load()
{
camera = new Camera (Engine.ScreenWidth, Engine.ScreenHeight);
effectManager = new EffectManager (this);
cats = new List<NyanCat>();
projectiles = new List<Projectile>();
batch = Engine.Batch;
catTexture = Engine.ContentManager.Load<Texture2D> ("NyanCat");
deathTexture = Engine.ContentManager.Load<Texture2D> ("Death");
healthBarTexture = Engine.ContentManager.Load<Texture2D> ("HealthBar");
reloadBarTexture = Engine.ContentManager.Load<Texture2D> ("ReloadBar");
nyanSoundEffect = Engine.ContentManager.Load<SoundEffect> ("Sound/Nyan");
nyanInstance = nyanSoundEffect.CreateInstance();
nyanInstance.IsLooped = false;
nyanInstance.Volume = 0.5f;
nyanInstance.Stop();
deathFont = Engine.ContentManager.Load<SpriteFont> ("DeathFont");
deathLocation = new Vector2 (HealthBarWidth + 20, 5);
EditorLoad();
}
示例12: RemoveSound
public void RemoveSound(SoundEffectInstance se)
{
se.Stop();
loopedSounds.Remove(se);
}
示例13: PoolSound
public void PoolSound(SoundEffectInstance sound, string soundName)
{
sound.Stop();
effectsPool[soundName].Enqueue(sound);
}
示例14: MouseClicked
//.........这里部分代码省略.........
if (mouseClickRect.Intersects(exitbuttonRect)) {
gameState = "StartMenu";
CheckGameState();
}
}//Victory state for beating the game
else if (gameState == "Victory") {
if (mouseClickRect.Intersects(rightStartButton)) {
gameState = "StartMenu";
CheckGameState();
}
}//Page for the Case story
else if (gameState == "Case") {
if (mouseClickRect.Intersects(rightStartButton)) {
SkillSystem.CreateSkills(Content, player);
Shooting.CreateWeapons(Content);
player.Health = player.MaxHealth;
player.Stamina = 100;
wepUnl = "";
player.Weapon = Shooting.weapons[1];
player.FrameLevel = 1;
currentLevel = 1;
enemies.Clear();
Items.Clear();
projectiles.Clear();
timer = 0;
gameState = "LevelSwitch";
CheckGameState();
}
}
//puased screen
else if (gameState == "Paused") {
if (mouseClickRect.Intersects(exitbuttonRect)) {
saveLevelClears();
song.Stop();
songPlaying = false;
gameState = "StartMenu";
CheckGameState();
} else if (mouseClickRect.Intersects(optionsButtonPosition)) {
try {
gameState = "OptionsMenu";
lastState = "Paused";
CheckGameState();
} catch (GameStateNotFoundException e) {
Console.WriteLine(e.ToString());
gameState = "";
}
} else if (mouseClickRect.Intersects(resumeButtonPosition)) {
try {
song.Resume();
gameState = "Playing";
CheckGameState();
} catch (GameStateNotFoundException e) {
Console.WriteLine(e.ToString());
gameState = "";
}
}
}
//options screen method
else if (gameState == "OptionsMenu") {
// back button clicked
if (mouseClickRect.Intersects(backButtonPosition)) {
try {
gameState = lastState;
CheckGameState();
} catch (GameStateNotFoundException e) {
示例15: Salon
protected void Salon()
{
count1 =0;
yeux = false;
vintro = false;
ouvrir = false;
cavev = false;
cuisinev1 = false;
cuisinev2 = false;
chambrev1 = false;
chambrev2 = false;
chambrev3 = false;
chambrev4 = false;
soundEffectInstance.Stop ();
finaction = false;
inputdebut = "";
issalon = true;
ischambre = false;
iscuisine = false;
iscave = false;
iscaveaction = false;
ischambreaction = false;
iscuisineaction = false;
isecrandebut = false;
iscave = false;
isecrandebut = false;
isecrandemarrage = false;
isfin = false;
compteurenigme= 0;
totalcuisine = 0;
totalcave = 0;
compteurA = 0;
compteurZ = 0;
// Fond de l'écran
background = Content.Load<Texture2D> ("Salon");
// Texture de la fille
girl.LoadContent ("Girl");
soundEffectInstance.Stop ();
soundeffect = Content.Load<SoundEffect> ("Sounds/Salon");
soundEffectInstance = soundeffect.CreateInstance ();
soundEffectInstance.IsLooped = true;
soundEffectInstance.Play ();
if (cuisinevalid && lettref)
{
soundEffectInstance.Stop ();
soundeffect = Content.Load<SoundEffect> ("Sounds/F");
soundEffectInstance = soundeffect.CreateInstance ();
soundEffectInstance.Play ();
lettref = false;
}
if (chambrevalid && lettrei)
{
soundEffectInstance.Stop ();
soundeffect = Content.Load<SoundEffect> ("Sounds/I");
soundEffectInstance = soundeffect.CreateInstance ();
soundEffectInstance.Play ();
lettrei = false;
}
if (cavevalid && lettreo)
{
soundEffectInstance.Stop ();
soundeffect = Content.Load<SoundEffect> ("Sounds/O");
soundEffectInstance = soundeffect.CreateInstance ();
soundEffectInstance.Play ();
lettreo = false;
}
}