本文整理汇总了C#中Microsoft.Xna.Framework.Audio.SoundEffectInstance.Pause方法的典型用法代码示例。如果您正苦于以下问题:C# SoundEffectInstance.Pause方法的具体用法?C# SoundEffectInstance.Pause怎么用?C# SoundEffectInstance.Pause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Audio.SoundEffectInstance
的用法示例。
在下文中一共展示了SoundEffectInstance.Pause方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Flyer
public Flyer(Texture2D spritesheet, Rectangle hitbox, List<Vector2> hitPolyPoints, Vector2 hitboxoffset)
: base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
{
_idleAnim = new SpriteAnim(spritesheet, 0, 1, 16, 16, 100, new Vector2(8, 8), false, false, 0);
_idleAnim.Pause();
_hitAnim = new SpriteAnim(spritesheet, 6, 1, 16, 16, 100, new Vector2(8, 8), false, false, _idleAnim.CurrentFrame);
_hitAnim.Pause();
_faceDir = Helper.Random.Next(2) == 0 ? -1 : 1;
gunLoop = AudioController.CreateInstance("minigun");
gunLoop.IsLooped = true;
gunLoop.Volume = 0f;
gunLoop.Play();
gunLoop.Pause();
}
示例2: Turret
public Turret(Texture2D spritesheet, Rectangle hitbox, List<Vector2> hitPolyPoints, Vector2 hitboxoffset)
: base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
{
_idleAnim = new SpriteAnim(spritesheet, 4, 2, 16, 16, 200, new Vector2(8, 8), true, false, 0);
_idleAnim.Play();
_hitAnim = new SpriteAnim(spritesheet, 10, 2, 16, 16, 200, new Vector2(8, 8), true, false, _idleAnim.CurrentFrame);
_hitAnim.Play();
gunLoop = AudioController.CreateInstance("minigun");
gunLoop.IsLooped = true;
gunLoop.Volume = 0f;
gunLoop.Play();
gunLoop.Pause();
Speed.X = Helper.Random.Next(2) == 0 ? -0.1f : 0.1f;
}
示例3: Boss
public Boss(Texture2D spritesheet, Rectangle hitbox, List<Vector2> hitPolyPoints, Vector2 hitboxoffset)
: base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
{
_idleAnim = new SpriteAnim(spritesheet, 0, 1, 32, 32, 0, new Vector2(16,16));
_hitAnim = new SpriteAnim(spritesheet, 5, 1, 32, 32, 0, new Vector2(16, 16));
_headGobAnim = new SpriteAnim(spritesheet, 1, 2, 32, 32, 0, new Vector2(16, 16));
_headGobAnimHit = new SpriteAnim(spritesheet, 6, 2, 32, 32, 0, new Vector2(16, 16));
_headEyeAnim = new SpriteAnim(spritesheet, 2, 6, 32, 32, 0, new Vector2(16, 16));
_headEyeAnimHit = new SpriteAnim(spritesheet, 7, 6, 32, 32, 0, new Vector2(16, 16));
_bodyAnim = new SpriteAnim(spritesheet, 3, 1, 32, 32, 0, new Vector2(16, 16));
_bodyAnimHit = new SpriteAnim(spritesheet, 8, 1, 32, 32, 0, new Vector2(16, 16));
_tailAnim = new SpriteAnim(spritesheet, 4, 1, 32, 32, 0, new Vector2(16, 16));
_tailAnimHit = new SpriteAnim(spritesheet, 9, 1, 32, 32, 0, new Vector2(16, 16));
laughLoop = AudioController.CreateInstance("boss");
laughLoop.Volume = 0f;
laughLoop.Pause();
}
示例4: Ship
public Ship(Texture2D spritesheet, Rectangle hitbox, List<Vector2> hitPolyPoints, Vector2 hitboxoffset)
: base(spritesheet, hitbox, hitPolyPoints, hitboxoffset)
{
Instance = this;
engineLoop = AudioController.CreateInstance("boost");
engineLoop.Volume = 0f;
engineLoop.IsLooped = true;
engineLoop.Play();
engineLoop.Pause();
engineLoop.Volume = 0.3f;
gunLoop = AudioController.CreateInstance("minigun");
gunLoop.IsLooped = true;
gunLoop.Volume = 0f;
gunLoop.Play();
gunLoop.Pause();
gunLoop.Volume = 0.3f;
hitLoop = AudioController.CreateInstance("shiphit");
hitLoop.IsLooped = false;
hitLoop.Volume = 1f;
_idleAnim = new SpriteAnim(spritesheet, 0, 1, 16, 16, 100, new Vector2(8, 8));
_idleAnim.Play();
_upAnim = new SpriteAnim(spritesheet, 1, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
_upAnim.Pause();
_downAnim = new SpriteAnim(spritesheet, 2, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
_downAnim.Pause();
_idleHitAnim = new SpriteAnim(spritesheet, 3, 1, 16, 16, 100, new Vector2(8, 8));
_idleHitAnim.Play();
_upHitAnim = new SpriteAnim(spritesheet, 4, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
_upHitAnim.Pause();
_downHitAnim = new SpriteAnim(spritesheet, 5, 2, 16, 16, 500, new Vector2(8, 8), false, false, 0);
_downHitAnim.Pause();
Active = true;
}
示例5: 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;
}
示例6: LoadContent
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(Game.GraphicsDevice);
sprites.Add("run-1", new Frame(new Microsoft.Xna.Framework.Rectangle(0, 0, 200, 230), Game.Content.Load<Texture2D>("Dash-1")));
sprites.Add("run-2", new Frame(new Microsoft.Xna.Framework.Rectangle(0, 0, 200, 230), Game.Content.Load<Texture2D>("Dash-2")));
sprites.Add("run-3", new Frame(new Microsoft.Xna.Framework.Rectangle(0, 0, 200, 230), Game.Content.Load<Texture2D>("Dash-3")));
sprites.Add("duck-1", new Frame(new Microsoft.Xna.Framework.Rectangle(0, 0, 200, 230), Game.Content.Load<Texture2D>("Dash-Slide-1")));
sprites.Add("duck-2", new Frame(new Microsoft.Xna.Framework.Rectangle(0, 0, 200, 230), Game.Content.Load<Texture2D>("Dash-Slide-2")));
sprites.Add("jump-1", new Frame(new Microsoft.Xna.Framework.Rectangle(0, 0, 200, 230), Game.Content.Load<Texture2D>("Dash-Jump-1")));
sprites.Add("jump-2", new Frame(new Microsoft.Xna.Framework.Rectangle(0, 0, 200, 230), Game.Content.Load<Texture2D>("Dash-Jump-2")));
sprites.Add("broom", new Frame(new Microsoft.Xna.Framework.Rectangle(0, 0, 300, 77), Game.Content.Load<Texture2D>("Besen")));
sprites.Add("buttons", new Frame(new Microsoft.Xna.Framework.Rectangle(0, 0, 800, 480), Game.Content.Load<Texture2D>("Buttons")));
sprites.Add("poof", new Frame(new Microsoft.Xna.Framework.Rectangle(0, 0, 200, 200), Game.Content.Load<Texture2D>("poof")));
defaultAnimation.Add(sprites["run-1"].Copy());
defaultAnimation.Add(sprites["run-2"].Copy());
defaultAnimation.Add(sprites["run-3"].Copy());
jumpAnimation.Add(sprites["jump-2"].Copy(0, -50));
jumpAnimation.Add(sprites["jump-1"].Copy(0, -100));
jumpAnimation.Add(sprites["jump-1"].Copy(0, -100));
jumpAnimation.Add(sprites["jump-1"].Copy(0, -100));
jumpAnimation.Add(sprites["jump-1"].Copy(0, -100));
jumpAnimation.Add(sprites["jump-1"].Copy(0, -100));
jumpAnimation.Add(sprites["jump-2"].Copy(0, -50));
duckAnimation.Add(sprites["duck-1"].Copy());
duckAnimation.Add(sprites["duck-2"].Copy());
duckAnimation.Add(sprites["duck-1"].Copy());
duckAnimation.Add(sprites["duck-2"].Copy());
int flyOffset = -25;
flyAnimation.Add(sprites["poof"].Copy(0, flyOffset + 50));
flyAnimation.Add(sprites["broom"].Copy(0, flyOffset));
flyAnimation.Add(sprites["broom"].Copy(0, flyOffset));
flyAnimation.Add(sprites["broom"].Copy(0, flyOffset));
flyAnimation.Add(sprites["broom"].Copy(0, flyOffset));
flyAnimation.Add(sprites["broom"].Copy(0, flyOffset));
flyAnimation.Add(sprites["poof"].Copy(0, flyOffset + 50));
pos.X = 50;
pos.Y = 370;
gallopSound = sound.Loop("gallop");
gallopSound.Volume = 1.0f;
gallopSound.Pause();
base.LoadContent();
}
示例7: PauseSoundEffect
public void PauseSoundEffect(string soundEffectName)
{
soundEffect = gestionnaireDeSoundEffect.Find(soundEffectName);
if (!(listeSound.Contains(soundEffectName)))
{
listeSound.Add(soundEffectName);
soundEffectInstanceList.Add(soundEffect.CreateInstance());
}
for (int i = 0; i < listeSound.Count; ++i)
{
test = string.Compare(listeSound[i], soundEffectName) == 0;
if (test)
{
index = i;
break;
}
}
test = false;
soundEffectInstance = soundEffectInstanceList[index];
soundEffectInstance.Pause();
}
示例8: Initialize
public void Initialize()
{
if (_engineOnLow != null)
{
return;
}
_isActive = true;
SoundEffect temp;
temp = Engine.Instance.ContentManager.Load<SoundEffect>(String.Format(BasePath + "/Vehicles/{0}/engine-on-low", _car.Descriptor.Name));
_engineOnLow = temp.CreateInstance();
//.Play(0.3f, 0, 0);
temp = Engine.Instance.ContentManager.Load<SoundEffect>(String.Format(BasePath + "/Vehicles/{0}/engine-on-high", _car.Descriptor.Name));
_engineOnHigh = temp.CreateInstance(); // temp.Play(0.3f, 0, 0);
temp = Engine.Instance.ContentManager.Load<SoundEffect>(String.Format(BasePath + "/Vehicles/{0}/engine-off-low", _car.Descriptor.Name));
_engineOffLow = temp.CreateInstance(); //temp.Play(0.3f, 0, 0);
temp = Engine.Instance.ContentManager.Load<SoundEffect>(String.Format(BasePath + "/Vehicles/{0}/engine-off-high", _car.Descriptor.Name));
_engineOffHigh = temp.CreateInstance(); //temp.Play(0.3f, 0, 0);
temp = Engine.Instance.ContentManager.Load<SoundEffect>(BasePath + "/Vehicles/common/grass_slide");
_offRoadInstance = temp.CreateInstance(); //temp.Play(0.3f, 0, 0, true);
_offRoadInstance.Pause();
_skids.Add(Engine.Instance.ContentManager.Load<SoundEffect>(BasePath + "/Vehicles/common/skid1"));
_skids.Add(Engine.Instance.ContentManager.Load<SoundEffect>(BasePath + "/Vehicles/common/skid2"));
_skids.Add(Engine.Instance.ContentManager.Load<SoundEffect>(BasePath + "/Vehicles/common/skid3"));
_engineOnLow.Pause();
_engineOnHigh.Pause();
_engineOffLow.Pause();
_engineOffHigh.Pause();
_gearChange = Engine.Instance.ContentManager.Load<SoundEffect>(String.Format(BasePath + "/Vehicles/{0}/gear-change", _car.Descriptor.Name));
}