当前位置: 首页>>代码示例>>C#>>正文


C# PlayerCharacter.LoadSounds方法代码示例

本文整理汇总了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();
        }
开发者ID:ebshimizu,项目名称:Parchment-Dragon,代码行数:52,代码来源:GameplayScreen.cs


注:本文中的PlayerCharacter.LoadSounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。