本文整理汇总了C#中Microsoft.Xna.Framework.Audio.SoundEffectInstance.Resume方法的典型用法代码示例。如果您正苦于以下问题:C# SoundEffectInstance.Resume方法的具体用法?C# SoundEffectInstance.Resume怎么用?C# SoundEffectInstance.Resume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Audio.SoundEffectInstance
的用法示例。
在下文中一共展示了SoundEffectInstance.Resume方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MouseClicked
//.........这里部分代码省略.........
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) {
Console.WriteLine(e.ToString());
gameState = "";
lastState = "";
}
}
// sounds button clicked
else if (mouseClickRect.Intersects(soundsButtonPosition)) {
try {
gameState = "SoundsMenu";
} catch (GameStateNotFoundException e) {
Console.WriteLine(e.ToString());
gameState = "";
}
}
// graphics button clicked
示例2: updateState
public bool updateState(KeyboardState State, KeyboardState oldState, ref bool songPlaying, ref SoundEffectInstance song) {
if (gameState == "Playing" && State.IsKeyDown(Keys.Escape) && oldState.IsKeyUp(Keys.Escape)) {
try {
song.Pause();
gameState = "Paused";
CheckGameState();
} catch (GameStateNotFoundException e) {
Console.WriteLine(e.ToString());
gameState = "";
}
return false;
} else if (gameState == "Paused") {
if (State.IsKeyDown(Keys.Escape) && oldState.IsKeyUp(Keys.Escape)) {
try {
song.Resume();
gameState = "Playing";
CheckGameState();
} catch (GameStateNotFoundException e) {
Console.WriteLine(e.ToString());
gameState = "";
}
}
return false;
}
if (gameState == "Loading" && isLoading) {
isLoading = true;
return true;
}
return false;
}
示例3: playSoundLoop
public static void playSoundLoop(string filename, ContentManager Content)
{
int index = 1;
if (loopInstance != null)
loopInstance.Stop();
if (lookUpTable.ContainsKey(filename))
{
lookUpTable.TryGetValue(filename, out index);
loopInstance = mySounds.ElementAt(index);
if (loopInstance.State == SoundState.Paused)
{
loopInstance.Resume();
}
else if (loopInstance.State == SoundState.Stopped)
{
loopInstance.Play();
}
}
else
{
soundEngine = Content.Load<SoundEffect>(filename);
loopInstance = soundEngine.CreateInstance();
mySounds.Add(loopInstance);
lookUpTable.Add(filename, numSounds);
numSounds++;
loopInstance.IsLooped = true;
loopInstance.Volume = 0.5f;
loopInstance.Play();
}
}