本文整理汇总了C#中Microsoft.Xna.Framework.Audio.SoundEffect类的典型用法代码示例。如果您正苦于以下问题:C# SoundEffect类的具体用法?C# SoundEffect怎么用?C# SoundEffect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SoundEffect类属于Microsoft.Xna.Framework.Audio命名空间,在下文中一共展示了SoundEffect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadContent
// Load Content
public void LoadContent(ContentManager Content)
{
//Attacks
attackSound = Content.Load<SoundEffect>(@"audio\attack");
smashAttackSound = Content.Load<SoundEffect>(@"audio\smashattack");
smashHitSound = Content.Load<SoundEffect>(@"audio\smashhit");
shockSound = Content.Load<SoundEffect>(@"audio\shock");
shockHitSound = Content.Load<SoundEffect>(@"audio\shockhit");
shockSmashHitSound = Content.Load<SoundEffect>(@"audio\shocksmashhit");
bulletSound = Content.Load<SoundEffect>(@"audio\bulletplus");
smashBulletSound = Content.Load<SoundEffect>(@"audio\smashbullet");
//Other
jumpSound = Content.Load<SoundEffect>(@"audio\jump");
doubleJumpSound = Content.Load<SoundEffect>(@"audio\doublejump");
shieldSound = Content.Load<SoundEffect>(@"audio\shield");
shieldBreakSound = Content.Load<SoundEffect>(@"audio\shieldbreak");
pikaBreakSound = Content.Load<SoundEffect>(@"audio\pikabreak");
selectSound = Content.Load <SoundEffect>(@"audio\select");
backSelectSound = Content.Load<SoundEffect>(@"audio\menuback");
respawnSound = Content.Load<SoundEffect>(@"audio\ballopen");
deathCrySound = Content.Load<SoundEffect>(@"audio\deathCry");
deathExplosionSound = Content.Load<SoundEffect>(@"audio\homerun");
menuMusic = Content.Load<Song>(@"audio\menumusic");
battleMusic = Content.Load<Song>(@"audio\battleMusic");
themeMusic = Content.Load<Song>(@"audio\theme");
danceMusic = Content.Load<Song>(@"audio\Gangnam Style");
}
示例2: SoundObject
//Modular Constructor
public SoundObject(SoundEffect target, Vector2 posn)
{
this.sound = target;
this.position = posn;
this.isModular = true;
this.dynamic = sound.CreateInstance();
}
示例3: LoadContent
public static void LoadContent()
{
for (int i = 0; i < cry.Length; i++)
{
cry[i] = c.Load<SoundEffect>("Sound\\cry" + i.ToString());
}
swoosh = c.Load<SoundEffect>("Sound\\swoosh");
shake = c.Load<SoundEffect>("Sound\\shake");
gun = c.Load<SoundEffect>("Sound\\gun");
spring = c.Load<SoundEffect>("Sound\\spring");
run = c.Load<SoundEffect>("Sound\\run");
reload = c.Load<SoundEffect>("Sound\\reload");
enemyDeath = c.Load<SoundEffect>("Sound\\zombie-death");
spawn = c.Load<SoundEffect>("Sound\\spawn");
spawn2 = c.Load<SoundEffect>("Sound\\spawn2");
coin = c.Load<SoundEffect>("Sound\\coin");
explosion1 = c.Load<SoundEffect>("Sound\\explode1");
explosion2 = c.Load<SoundEffect>("Sound\\explode2");
ladder = c.Load<SoundEffect>("Sound\\ladder");
catchBaby = c.Load<SoundEffect>("Sound\\smack");
slice = c.Load<SoundEffect>("Sound\\slice");
banshee = c.Load<SoundEffect>("Sound\\banshee");
LoadInstances();
}
示例4: PostGameState
public PostGameState( int score ) : base()
{
m_heading = content.Load<Texture2D>("Images/GameOverTitle");
m_backgroundSprite = content.Load<Texture2D>("Images/MenuBackground");
m_indicator = content.Load<Texture2D>("Images/LeftSelector");
m_scoresText = content.Load<Texture2D>("Images/ScoreText");
m_nameText = content.Load<Texture2D>("Images/NameText");
m_acceptText = content.Load<Texture2D>("Images/AcceptText");
m_indicatorLeftPosition = new Vector2(412, 378);
m_indicatorRightPosition = new Vector2(448, 378);
m_blipSound = content.Load<SoundEffect>("Sounds/Blip");
m_blipVolume = 0.1f;
m_playerScore = score;
m_highScoreList = new HighScoresObject();
m_highScoreList.LoadHighScores();
m_buttonSelected = 0;
m_letterInt = new List<int>();
m_letterInt.Add(0);
m_letterInt.Add(0);
m_letterInt.Add(0);
m_letterString = new List<string>();
m_letterString.Add("A");
m_letterString.Add("A");
m_letterString.Add("A");
}
示例5: 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);
//TODO: use this.Content to load your game content here
monkey = Content.Load<Texture2D> ("monkey");
background = Content.Load <Texture2D> ("background");
logo = Content.Load<Texture2D> ("logo");
font = Content.Load<SpriteFont> ("font");
hit = Content.Load<SoundEffect> ("hit");
title = Content.Load<Song> ("title");
Microsoft.Xna.Framework.Media.MediaPlayer.IsRepeating = true;
Microsoft.Xna.Framework.Media.MediaPlayer.Play (title);
var viewport = graphics.GraphicsDevice.Viewport;
var padding = (viewport.Width / 100);
var gridWidth = (viewport.Width - (padding * 5)) / 4;
var gridHeight = gridWidth;
for (int y = padding; y < gridHeight*5; y+=gridHeight+padding) {
for (int x = padding; x < viewport.Width-gridWidth; x+=gridWidth+padding) {
grid.Add (new GridCell () {
DisplayRectangle = new Rectangle (x, y, gridWidth, gridHeight)
});
}
}
}
示例6: Initialize
public static void Initialize(ContentManager content)
{
scream = content.Load<SoundEffect>("Assets/Sounds/deathScream");
collectSound = content.Load<SoundEffect>("Assets/Sounds/itemCollect");
checkpointHell = content.Load<SoundEffect>("Assets/Sounds/CheckpointHell");
checkpointCrystal = content.Load<SoundEffect>("Assets/Sounds/CheckpointCristall");
fireball = content.Load<SoundEffect>("Assets/Sounds/Fireball");
freezingIce = content.Load<SoundEffect>("Assets/Sounds/freezingIce");
whip = content.Load<SoundEffect>("Assets/Sounds/whip");
laser = content.Load<SoundEffect>("Assets/Sounds/laser");
SeraphinScream = content.Load<SoundEffect>("Assets/Sounds/SeraphinScream");
thunder = content.Load<SoundEffect>("Assets/Sounds/thunder");
spear = content.Load<SoundEffect>("Assets/Sounds/spear");
claws = content.Load<SoundEffect>("Assets/Sounds/claws");
mainMenu = content.Load<SoundEffect>("Assets/Sounds/mainMenu");
menu = mainMenu.CreateInstance();
menu.IsLooped = true;
punch = content.Load<SoundEffect>("Assets/Sounds/punch");
waterSound = content.Load<SoundEffect>("Assets/Sounds/water");
water = waterSound.CreateInstance();
spawn = content.Load<SoundEffect>("Assets/Sounds/spawn");
minionsFraktus = content.Load<SoundEffect>("Assets/Sounds/minions");
goldCave = content.Load<SoundEffect>("Assets/Sounds/GoldCave");
cave = goldCave.CreateInstance();
//cave.IsLooped = true;
//background crystal
crystalBackground = content.Load<SoundEffect>("Assets/Sounds/crystalBackground");
crystalBG = crystalBackground.CreateInstance();
crystalBG.Volume = 0.25f;
crystalBG.IsLooped = true;
}
示例7: cChampBtn
public cChampBtn(Texture2D newTexture, SoundEffect newSound, GraphicsDevice graphics)
{
texture = newTexture;
sound = newSound;
}
示例8: LoadContent
public static void LoadContent(ContentManager aContent)
{
s_AngrySounds = new SoundEffect[] {
aContent.Load<SoundEffect>("sound/Grumble_01"),
aContent.Load<SoundEffect>("sound/Grumble_02"),
aContent.Load<SoundEffect>("sound/Grumble_03"),
aContent.Load<SoundEffect>("sound/Grumble_04"),
aContent.Load<SoundEffect>("sound/Grumble_05"),
aContent.Load<SoundEffect>("sound/Grumble_06"),
aContent.Load<SoundEffect>("sound/Grumble_07"),
aContent.Load<SoundEffect>("sound/Grumble_08"),
};
s_ExplodeSounds = new SoundEffect[] {
aContent.Load<SoundEffect>("sound/Burst_01"),
aContent.Load<SoundEffect>("sound/Burst_02")
};
s_NomSounds = new SoundEffect[] {
aContent.Load<SoundEffect>("sound/Eat_01"),
aContent.Load<SoundEffect>("sound/Eat_02"),
aContent.Load<SoundEffect>("sound/Eat_03"),
aContent.Load<SoundEffect>("sound/Eat_04"),
aContent.Load<SoundEffect>("sound/Eat_05"),
aContent.Load<SoundEffect>("sound/Eat_06")
};
s_PickUpSound = aContent.Load<SoundEffect>("sound/Pickup");
}
示例9: Initialize
/// <summary>
/// Initializes all the audio content.
/// </summary>
/// <param name="Content">The ContentManager to use</param>
public static void Initialize(ContentManager Content)
{
try
{
// Songs
GameplayMusic = Content.Load<Song>("audio/GameplayMusic");
GameplayMusic2 = Content.Load<Song>("audio/GameplayMusic2");
GameplayMusic3 = Content.Load<Song>("audio/GameplayMusic3");
TitleMusic = Content.Load<Song>("audio/TitleMusic");
VictoryMusic = Content.Load<Song>("audio/VictoryMusic");
// Sound Effects
Soldier_Attack = Content.Load<SoundEffect>("audio/Soldier_Attack");
Soldier_Dying = Content.Load<SoundEffect>("audio/Soldier_Dying");
Worker_Dying = Content.Load<SoundEffect>("audio/Worker_Dying");
Worker_Attack = Content.Load<SoundEffect>("audio/Worker_Attack");
Zombie_Dying = Content.Load<SoundEffect>("audio/Zombie_Dying");
Zombie_Attack = Content.Load<SoundEffect>("audio/Zombie_Attack");
}
catch (Exception e)
{
audioReady = false;
}
MediaPlayer.Volume = 0.50f;
MediaPlayer.IsRepeating = true;
play("music", "title");
}
示例10: GameManager
public GameManager(Game game, int level)
{
mGame = game;
mPlayer1 = new Character(game, new Pointf(400, 200), new Size(32, 32), new Velocity(), PlayerIndex.One);
mPlayer2 = new Character(game, new Pointf(350, 200), new Size(32, 32), new Velocity(), PlayerIndex.Two);
mBoss = null;
mLevel = level;
switch (level)
{
case 1:
mMap = MapBuilder.BuildLevel1(mGame, new Size(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), ref mPlayer1);
mPlayer1.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
mPlayer2.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
mBackgroundSong = mGame.Content.Load<Song>("music/Electrolyte - New Mission");
break;
case 2:
mMap = MapBuilder.BuildSolo(mGame, new Size(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), ref mPlayer1);
mPlayer1.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
mPlayer2.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(MapHelper.GetLastColumn()-1.5f, 1));
mBackgroundSong = mGame.Content.Load<Song>("music/Electrolyte - Plus vs Minus");
break;
case 3:
mMap = MapBuilder.BuildBossLevel(mGame, new Size(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), ref mPlayer1);
mBoss = new Character(game, new Pointf(350, MapHelper.GetPlatformYAtLevel(1.5f)), new Size(64, 64), new Velocity(), PlayerIndex.Three);
mBackgroundSong = mGame.Content.Load<Song>("music/Electrolyte - Volt");
break;
}
mHud = new Hud(new Pointf(0, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), mGame, level);
mIsPlayingSound = false;
mGangnamSound = game.Content.Load<SoundEffect>("newgangnam");
mGangnamInstance = mGangnamSound.CreateInstance();
}
示例11: View
public View(GraphicsDeviceManager a_manager, ContentManager a_contentLoader)
{
//this is needed to draw sprites
m_spriteBatch = new SpriteBatch(a_manager.GraphicsDevice);
//Load content
m_tileTexture = a_contentLoader.Load<Texture2D>("FinalTiles5");
m_playerTexture = a_contentLoader.Load<Texture2D>("WalkingSquare");
m_playerTextureLeft = a_contentLoader.Load<Texture2D>("player2left");
m_enemyTexture = a_contentLoader.Load<Texture2D>("Enemy2");
m_smokeTexture = a_contentLoader.Load<Texture2D>("smoke1");
m_backgroundTexture = a_contentLoader.Load<Texture2D>("LimboFinal");
m_jumpSound = a_contentLoader.Load<SoundEffect>("14");
m_pointSound = a_contentLoader.Load<SoundEffect>("7");
m_deathSound = a_contentLoader.Load<SoundEffect>("8");
m_textfont = a_contentLoader.Load<SpriteFont>("Font");
Moonchild =a_contentLoader.Load<Song>("3");
MediaPlayer.IsRepeating = true;
MediaPlayer.Volume = 0.3f;
SoundEffect.MasterVolume = 0.6f;
if (!songstart)
{
MediaPlayer.Play(Moonchild);
songstart = true;
}
}
示例12: Fireball
//Constructor
public Fireball(ContentManager content, Vector2 position, int direction, MouseState ms)
{
this.texture = content.Load<Texture2D>(@"pictures\Fireball");
sound = content.Load<SoundEffect>(@"music\shotgun");
Fireball.Sound.Play(0.5f, 0.0f, 0.0f);
if (direction == 1)
{
this.position = position + new Vector2(80f, 60f);
Vector2 speed = this.CalculateSpeed(this.position, ms);
this.speed = new Vector2(this.maxSpeed * speed.X,
this.maxSpeed * speed.Y);
this.effect = SpriteEffects.None;
}
else
{
this.position = position + new Vector2(0f, 60f);
Vector2 speed = this.CalculateSpeed(this.position, ms);
this.speed = new Vector2(-this.maxSpeed * speed.X,
-this.maxSpeed * speed.Y);
this.effect = SpriteEffects.FlipHorizontally;
}
this.destinationRect = new Rectangle((int)this.position.X, (int)this.position.Y, 25, 24);
this.sourceRect = new Rectangle(0, 0, 50, 48);
}
示例13: Moto
public Moto(ContentManager Content, GameWindow Window)
: base(Content.Load<Texture2D>("moto"))
{
this.Window = Window;
textura = Content.Load<Texture2D>("moto");
posicao = new Vector2(200, 300);
ronco = Content.Load<SoundEffect>("Sounds/SoundEffects/sound_effect");
andando = new animacao();
andando.quadro_X = 67;
andando.quadro_Y = 47;
andando.qtd_quadros = 3;
andando.quadros_seg = 3;
andando.Y = 0;
correndo = new animacao();
correndo.quadro_X = 67;
correndo.quadro_Y = 47;
correndo.qtd_quadros = 3;
correndo.quadros_seg = 9;
correndo.Y = 47;
animacao_atual = correndo;
}
示例14: PinchAddNewInteraction
public PinchAddNewInteraction(TapEditInteraction editInteraction, PullDownItem pullDownItem)
{
_editInteraction = editInteraction;
_pullDownItem = pullDownItem;
_popSound = SoundEffect.FromStream(Microsoft.Xna.Framework.TitleContainer.OpenStream("Sounds/pop.wav"));
}
示例15: Gun
public Gun(Texture2D[] inputTexture, SoundEffect inputZap)
{
// Gun's textures.
textureHolding = inputTexture;
gunTexture = inputTexture[0];
borderTexture = inputTexture[2];
// Munitions-in-flight.
BULLETS = new List<Bullet>();
// Offset for animation rotation.
rotationOffset = new Vector2(17.5F, 9);
// Width and height of the gun's sprite.
frameWidth = 35;
frameHeight = 18;
// Color, rotation, and effects.
color = Color.White;
rotation = 0;
effects = SpriteEffects.None;
// Where do you want the gun placed relative to the vector it is attached too?
placementXOffset = 15;
placementYOffset = 35;
// Zap sound effect.
zap = inputZap;
animationFrame = new Rectangle(0, 0, frameWidth, frameHeight);
mineSpawn = new Stopwatch();
}