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


C# Framework.GameTime类代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.GameTime的典型用法代码示例。如果您正苦于以下问题:C# GameTime类的具体用法?C# GameTime怎么用?C# GameTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GameTime类属于Microsoft.Xna.Framework命名空间,在下文中一共展示了GameTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

 public void Update(GameTime gameTime)
 {
     if (powerup == null)
     {
         if (remaining < 0)
         {
             remaining = rand.NextDouble() * 10 + 10;
             lock (phyWorld)
                 powerup = (Powerup)Activator.CreateInstance(
                     types[rand.Next(0, types.Length)], phyWorld, gameplay, rand);
             powerup.LoadContent(content);
         }
         else
             remaining -= gameTime.ElapsedGameTime.TotalSeconds;
     }
     else
     {
         if (powerup.IsActive)
             powerup.Update();
         else
         {
             phyWorld.RemoveBody(powerup);
             powerup = null;
         }
     }
 }
开发者ID:hassanselim0,项目名称:Microsoft-Surface-Base-Defense-Game,代码行数:26,代码来源:PowerupManager.cs

示例2: Draw

 public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     if (sprite != null && visible)
     {
         spriteBatch.Draw(sprite, position, null, Color.White, 0, Vector2.Zero, new Vector2(1, spriteScale), SpriteEffects.None, 0);
     }
 }
开发者ID:Chartle,项目名称:Gameprogrammeren-Practica,代码行数:7,代码来源:GameObject.cs

示例3: Update

        protected override void Update(GameTime gameTime)
        {
            float time = (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            map.Update(time);

            base.Update(gameTime);
        }
开发者ID:eriksk,项目名称:OGMaps,代码行数:7,代码来源:Game1.cs

示例4: Draw

 protected override void Draw(GameTime gameTime)
 {
     base.Draw(gameTime);
     this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
     this.spriteBatch.DrawString(this.font, "", new Vector2(1f, 1f), Color.White, 0f, Vector2.Zero, (float)1f, SpriteEffects.None, 1f);
     this.spriteBatch.End();
 }
开发者ID:Riketta,项目名称:TerraDev,代码行数:7,代码来源:InjectedMain.cs

示例5: Draw

        /// <summary>
        /// Draws the menu.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.Transform);

            // Draw the menu title.
            if (titleTexture == null)
                spriteBatch.DrawString(ScreenManager.GameContent.gameFont, titleString,
                    titlePosition, Color.White * TransitionAlpha, 0, Vector2.Zero,
                    titleSize / ScreenManager.GameContent.gameFontSize,
                    SpriteEffects.None, 0);
            else
                spriteBatch.Draw(titleTexture, titlePosition, Color.White * TransitionAlpha);

            // Draw each menu entry in turn.
            for (int i = 0; i < menuEntries.Count; i++)
            {
                MenuEntry menuEntry = menuEntries[i];

                bool isSelected = IsActive && (i == selectedEntry);

                menuEntry.Draw(isSelected, gameTime);
            }

            spriteBatch.End();
        }
开发者ID:BitSits,项目名称:BitSits-Framework-10---Push-Puzzle,代码行数:30,代码来源:MenuScreen.cs

示例6: Update

 public override void Update(GameTime gameTime)
 {
     Position += Speed;
     Angle += AngularSpeed;
     Opacity -= OpacityChange;
     CurrentLife += gameTime.ElapsedGameTime.Milliseconds;
 }
开发者ID:vinterdo,项目名称:CryOfSpace,代码行数:7,代码来源:Particle.cs

示例7: Draw

 /// <summary>
 /// Allows the game component to update itself.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 public override void Draw(GameTime gameTime)
 {
     GestionSprites.Begin();
     GestionSprites.DrawString(Font,TexteÀAfficher, Position, CouleurTexte,0,Origine,Échelle, SpriteEffects.None,1f);
     GestionSprites.End();
     base.Draw(gameTime);
 }
开发者ID:HazWard,项目名称:Tank3D,代码行数:11,代码来源:TexteCentré.cs

示例8: Draw

        public override void Draw(GameTime gameTime)
        {
            Matrix world = Matrix.CreateRotationY(this.rotation) * Matrix.CreateTranslation(this.position + (Vector3.Up * height));

            Matrix[] transforms = new Matrix[this.model.Bones.Count];
            this.model.CopyAbsoluteBoneTransformsTo(transforms);

            GraphicsDevice.BlendState = BlendState.AlphaBlend;
            GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.World = transforms[mesh.ParentBone.Index] * world;
                    effect.View = CanyonGame.Camera.View;
                    effect.Projection = CanyonGame.Camera.Projection;
                    effect.Alpha = this.alpha;
                    effect.EnableDefaultLighting();
                    effect.PreferPerPixelLighting = true;
                }

                mesh.Draw();
            }

            base.Draw(gameTime);
        }
开发者ID:koenbollen,项目名称:canyon,代码行数:28,代码来源:Marker.cs

示例9: Draw

 protected override void Draw(GameTime gameTime)
 {
     resolver.RunAllRunners();
     if (runCodeForTests != null)
         runCodeForTests();
     resolver.RunAllPresenters();
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:7,代码来源:XnaGame.cs

示例10: Update

        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            currentstate = Keyboard.GetState();

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();

            // TODO: Add your update logic here
            else
            {
                if (currentstate.IsKeyDown(Keys.A) && !oldstate.IsKeyDown(Keys.A))
                {
                    sounds[0].Play();
                    //var sd = soundEffects[0].CreateInstance();
                    //sd.IsLooped = false;
                    //sd.Play();
                    //sd.Dispose();
                }
                if (currentstate.IsKeyDown(Keys.R) && !oldstate.IsKeyDown(Keys.R)) { rd.BMS파일분석(); }
                if (currentstate.IsKeyDown(Keys.Y) && !oldstate.IsKeyDown(Keys.Y)) { rd.노트시간계산();sdmgr.시간들 = rd.시간들; }
                if (currentstate.IsKeyDown(Keys.S) && !oldstate.IsKeyDown(Keys.S))
                {
                    sdmgr.Play();
                    //var sd = soundEffects[1].CreateInstance();
                    //sd.Play();
                }

                oldstate = currentstate;
            }
            

            base.Update(gameTime);
        }
开发者ID:ProjectEli,项目名称:BMS_Eli,代码行数:38,代码来源:GameMgr.cs

示例11: Update

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here
            this.time += gameTime.ElapsedGameTime.Milliseconds;
            if (this.time >= 1000)
            {
                this.time = 0;
                this.s += 1;
                //if (s >= 60)
                //{
                //    s = 0;
                //    m += 1;
                //    if (m >= 60)
                //        h += 1;
                //}
                //if (h > 0)
                //    Console.WriteLine("時間計時:" + h + "小時" + m + "分" + s + "秒");
                //else if (m > 0)
                //    Console.WriteLine("時間計時:" + m + "分" + s + "秒");
                //else
                    Console.WriteLine("時間計時:" + s + "秒");
                    if (s > time_Max)
                        s = time_Max;
            }

            base.Update(gameTime);
        }
开发者ID:YingChieh,项目名称:Throw-Fish-In,代码行数:31,代码来源:Time_Bar.cs

示例12: Update

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (left.Clicked) this.SceneNavigator.MoveToScene(Scenes.SCENE_2);
            if (right.Clicked) this.SceneNavigator.MoveToScene(Scenes.SCENE_2);
        }
开发者ID:vkrajacic89,项目名称:MagiciansEscape-TVZ,代码行数:7,代码来源:Scene2Crown.cs

示例13: Draw

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Vector2 position, SpriteEffects spriteEffects)
        {
            if (Animation == null)
            {
                throw new NotSupportedException("No animation is currently playing.");
            }

            time += (float)gameTime.ElapsedGameTime.TotalSeconds;
            while (time > Animation.frameTime)
            {
                time -= Animation.frameTime;

                if (Animation.isLooping)
                {
                    frameIndex = (frameIndex + 1) % Animation.FrameCount;

                }
                else
                {
                    frameIndex = Math.Min(frameIndex + 1, Animation.FrameCount - 1);
                }
            }

            Rectangle source = new Rectangle(FrameIndex * Animation.FrameWidth, 0, Animation.FrameWidth, Animation.FrameHeight);

            spriteBatch.Draw(animation.texture, position, source, Color.White, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0.0f);
        }
开发者ID:WINPROG20152016,项目名称:Penaranda_TapTitanXNA,代码行数:27,代码来源:AnimationPlayer.cs

示例14: Update

        public override void Update(GameTime gameTime)
        {
            ControlManager.Update(gameTime, PlayerIndex.One);

            base.Update(gameTime);

        }
开发者ID:brollins90,项目名称:eotd,代码行数:7,代码来源:LoadGameScreen.cs

示例15: DrawFlagScore

        public void DrawFlagScore(SpriteBatch spriteBatch, GameTime gameTime, float stoppingHeight)
        {
            scoreOrigin = ScoreFont.MeasureString(scoreText) / GameValues.ScoreSpriteScoreOriginOffset;

            spriteBatch.DrawString(ScoreFont, scoreText, new Vector2(Position.X, Position.Y - GameValues.ScoreSpriteDrawFlagScoreYOffset), Color.White, 0, scoreOrigin, 0.4f, SpriteEffects.None, 0f);

            if (Position.Y > stoppingHeight)
            {
                Position = new Vector2(Position.X, Position.Y - GameValues.ScoreSpriteDrawFlagScoreDropOffet);
            }
            else if (Position.Y <= stoppingHeight)
            {
                //Position.Y = stoppingHeight;
                Position = new Vector2(Position.X, stoppingHeight);
                if (scoreBuffer <= 0)
                {
                    scoreBuffer = GameValues.ScoreSpriteScoreBuffer;
                    ScoringOn = !ScoringOn;
                }
                else
                {
                    scoreBuffer--;
                }
            }
        }
开发者ID:BoltThrower,项目名称:Super-Mario-World-1-1,代码行数:25,代码来源:ScoreSprite.cs


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