本文整理汇总了C#中PlayerCharacter.LoadSounds方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerCharacter.LoadSounds方法的具体用法?C# PlayerCharacter.LoadSounds怎么用?C# PlayerCharacter.LoadSounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCharacter
的用法示例。
在下文中一共展示了PlayerCharacter.LoadSounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadContent
/// <summary>
/// Load graphics content for the game.
/// </summary>
public override void LoadContent()
{
if (content == null)
content = new ContentManager(ScreenManager.Game.Services, "Content");
gameFont = content.Load<SpriteFont>("gamefont");
// Create a new SpriteBatch, which can be used to draw textures.
viewportRect = new Rectangle(0, 0,
(int)(this.ScreenManager.GraphicsDevice.Viewport.Width * .75f),
this.ScreenManager.GraphicsDevice.Viewport.Height);
enemyFieldBound = new Rectangle(
-(int)(this.ScreenManager.GraphicsDevice.Viewport.Width * .25f),
-(int)(this.ScreenManager.GraphicsDevice.Viewport.Height * .25f),
(int)(this.ScreenManager.GraphicsDevice.Viewport.Width * 1.5f),
(int)(this.ScreenManager.GraphicsDevice.Viewport.Height * 1.5f));
if (enemies == null) enemies = new EnemyList(content);
if (foods == null) foods = new FoodList(content);
if (stage == null) stage = new Stage1(content, this.ScreenManager.GraphicsDevice, enemies);
if (player1 == null)
{
player1 = new PlayerCharacter(
content.Load<Texture2D>("PC\\player_flying"),
content.Load<Texture2D>("PC\\player_death"),
content.Load<Texture2D>("Bullets\\fireball0001"),
content.Load<Texture2D>("Food\\foodgauge"),
content.Load<Texture2D>("Food\\foodbar"),
viewportRect);
player1.LoadSounds(content);
}
healthBarBG = content.Load<Texture2D>("Enemies\\healthBar");
healthBarFill = content.Load<Texture2D>("Enemies\\healthBarFill");
UIFont = content.Load<SpriteFont>("UI");
// A real game would probably have more content than this sample, so
// it would take longer to load. We simulate that by delaying for a
// while, giving you a chance to admire the beautiful loading screen.
Thread.Sleep(1000);
backgroundMusic = content.Load<SoundEffect>("Sounds\\backgroundmusic");
instance = backgroundMusic.CreateInstance();
instance.IsLooped = true;
instance.Play();
// once the load has finished, we use ResetElapsedTime to tell the game's
// timing mechanism that we have just finished a very long frame, and that
// it should not try to catch up.
ScreenManager.Game.ResetElapsedTime();
}