• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Framework.GameTimerEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Update

        public void Update( GameTimerEventArgs gameTime )
        {
            TimeToChange -= gameTime.ElapsedTime;
            if( TimeToChange < TimeSpan.Zero ) {
                m_Position = new Vector2(
                    s_RandomNumberGenerator.Next( 0, m_Device.Viewport.Width ),
                    s_RandomNumberGenerator.Next( 0, m_Device.Viewport.Height ) );

                m_Shading = new Color(
                    s_RandomNumberGenerator.Next( 0, 255 ),
                    s_RandomNumberGenerator.Next( 0, 255 ),
                    s_RandomNumberGenerator.Next( 0, 255 ),
                    s_RandomNumberGenerator.Next( 0, 255 ) );

                m_SpriteFrame = new Rectangle( m_Frame * 5, 0, 5, 5 );

                if( m_SpriteFrame.X + m_SpriteFrame.Width == s_Sprite.Width ) {
                    m_Frame = 0;

                    m_Position = new Vector2(
                        s_RandomNumberGenerator.Next( 0, m_Device.Viewport.Width ),
                        s_RandomNumberGenerator.Next( 0, m_Device.Viewport.Height ) );

                    m_Shading = new Color(
                        s_RandomNumberGenerator.Next( 0, 255 ),
                        s_RandomNumberGenerator.Next( 0, 255 ),
                        s_RandomNumberGenerator.Next( 0, 255 ),
                        s_RandomNumberGenerator.Next( 0, 255 ) );
                } else {
                    ++m_Frame;
                }

                TimeToChange = new TimeSpan( 0, 0, 0, 0, 100 * s_RandomNumberGenerator.Next( 1, 6 ) );
            }
        }
开发者ID:freestylecoder,项目名称:GameComponents,代码行数:35,代码来源:Star.cs


示例2: Update

        public void Update(GameTimerEventArgs e)
        {
            // Calculate the time/movement scalar for this entity
            timeScalar = (float)e.ElapsedTime.TotalMilliseconds;

            Angle += 0.001f * timeScalar;
        }
开发者ID:JohanGl,项目名称:Moon,代码行数:7,代码来源:BlackHole.cs


示例3: Draw

        /// <summary>
        /// Advances the time position and draws the current frame of the animation.
        /// </summary>
        public void Draw(GameTimerEventArgs gameTime, SpriteBatch spriteBatch, Vector2 position, SpriteEffects spriteEffects)
        {
            if (Animation == null)
                throw new NotSupportedException("No animation is currently playing.");

            // Process passing time.
            time += (float)gameTime.ElapsedTime.TotalSeconds;
            while (time > Animation.FrameTime)
            {
                time -= Animation.FrameTime;

                // Advance the frame index; looping or clamping as appropriate.
                if (Animation.IsLooping)
                {
                    frameIndex = (frameIndex + 1) % Animation.FrameCount;
                }
                else
                {
                    frameIndex = Math.Min(frameIndex + 1, Animation.FrameCount - 1);
                }
            }

            // Calculate the source rectangle of the current frame.
            Rectangle source = new Rectangle(FrameIndex * Animation.Texture.Height, 0, Animation.Texture.Height, Animation.Texture.Height);

            // Draw the current frame.
            spriteBatch.Draw(Animation.Texture, position, source, Color.White, 0.0f, Origin, 1.0f, spriteEffects, 0.0f);
        }
开发者ID:rahulpshephertz,项目名称:Platformer,代码行数:31,代码来源:AnimationPlayer.cs


示例4: checkTouchpoints

        /// <summary>
        /// Checks all touchpoints at each call
        /// </summary>
        /// <param name="gameTime">The GameTimerEventArgs</param>
        public static void checkTouchpoints(GameTimerEventArgs gameTime)
        {
            while (TouchPanel.IsGestureAvailable)
            {
                GestureSample gs = TouchPanel.ReadGesture();

                switch (gs.GestureType)
                {
                    case GestureType.FreeDrag:
                        HandleShipTouchment(gs);
                        break;
                    case GestureType.DragComplete:
                        if (AppCache.CurrentMatch != null)
                        {
                            if (AppCache.CurrentMatch.MatchState == Enum.MatchState.ShipPlacement)
                            {
                                Point p = new Point(Convert.ToInt32(gs.Position.X), Convert.ToInt32(gs.Position.Y));
                                foreach (Ship s in AppCache.CurrentMatch.OwnShips)
                                {
                                    if (s.isTouched)
                                    {
                                        s.GlueToFields();
                                        AppCache.CurrentMatch.OwnPlayground.Refresh();
                                        s.isTouched = false;
                                        VibrationManager.Vibration.Start(new TimeSpan(0, 0, 0, 0, 100));
                                    }
                                }
                            }
                        }
                        break;
                    case GestureType.Tap:

                        #region Buttons
                        foreach (IconButton b in AppCache.CurrentMatch.FooterMenu.Buttons)
                        {
                            if (b != null)
                                b.CheckClick(gs);
                        }

                        for (int i = 0; i < AppCache.CurrentMatch.FooterMenu.Dices.Length; i++)
                        {
                            if (AppCache.CurrentMatch.FooterMenu.Dices[i] != null)
                            {
                                AppCache.CurrentMatch.FooterMenu.Dices[i].CheckClick(gs);
                            }
                        }
                        AppCache.CurrentMatch.OwnPlayground.CheckClick(gs);
                        AppCache.CurrentMatch.ShootingPlayground.CheckClick(gs);

                        #region Ships
                        HandleShipSelection(gs);
                        #endregion

                    #endregion
                            break;
                }

            }
        }
开发者ID:schiffchen,项目名称:windows-phone,代码行数:63,代码来源:TouchManager.cs


示例5: Update

 public void Update(GameTimerEventArgs e)
 {
     if (TargetActor != null)
     {
         Position = new Vector3(TargetActor.Position.X, TargetActor.Position.Y, 1.0f);
         Target = new Vector3(TargetActor.Position.X, TargetActor.Position.Y, 0.0f);
     }
 }
开发者ID:ronforbes,项目名称:omega,代码行数:8,代码来源:Camera3D.cs


示例6: Update

        public override void Update(GameTimerEventArgs gameTime)
        {
            // Animate same way with normal AnimatedSprite //
            //base.Update(gameTime);

            if (IsAlive && !IsStunned) {
                this.X = this.X-Velocity;
            }
        }
开发者ID:cikidot,项目名称:game-xna-herobot,代码行数:9,代码来源:Enemy.cs


示例7: Update

        public override void Update(GameTimerEventArgs e)
        {
            foreach (Multiplier m in Multipliers)
            {
                m.HandleCollisions();
            }

            base.Update(e);
        }
开发者ID:ronforbes,项目名称:vectorarena_backup,代码行数:9,代码来源:MultiplierManager.cs


示例8: Update

        public override void Update(GameTimerEventArgs e)
        {
            foreach (Bullet b in Bullets)
            {
                b.HandleCollisions();
            }

            base.Update(e);
        }
开发者ID:ronforbes,项目名称:vectorarena_backup,代码行数:9,代码来源:BulletManager.cs


示例9: onUpdate

 public void onUpdate(GameTimerEventArgs e)
 {
     if (wait) time += (float)e.ElapsedTime.TotalSeconds;
     if (time > 0.5)
     {
         time = 0;
         wait = false;
     }
 }
开发者ID:cikidot,项目名称:game-xna-herobot,代码行数:9,代码来源:ProjectileBase.cs


示例10: Update

        public override void Update(GameTimerEventArgs e)
        {
            if (!ShipManager.PlayerShip.Alive)
            {
                gameOver = true;
            }

            base.Update(e);
        }
开发者ID:ronforbes,项目名称:vectorarena_backup,代码行数:9,代码来源:MarathonScene.cs


示例11: OnDraw

        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.White);

            // TODO: Add your drawing code here
            var gameTime = new GameTime(e.TotalTime, e.ElapsedTime);
            spriteBatch.Begin();
            level.Draw(gameTime, spriteBatch);
            spriteBatch.End();
        }
开发者ID:Alxandr,项目名称:Hackaton,代码行数:13,代码来源:GamePage.xaml.cs


示例12: Draw

 public void Draw(SpriteBatch spriteBatch, GameTimerEventArgs gameTime)
 {
     for (int n = 0; n < spriteList.Count; n++)
     {
         if (spriteList[n].IsValid(gameTime))
         {
             spriteList[n].Draw(gameTime, spriteBatch);
         }
     }
 }
开发者ID:cikidot,项目名称:game-xna-herobot,代码行数:10,代码来源:SpriteList.cs


示例13: Update

 public void Update(object sender, GameTimerEventArgs e)
 {
     // TODO: Fügen Sie Ihre Aktualisierungslogik hier hinzu
     this.offset -= 15;
     if (this.offset < -Background.SliceWidth)
     {
         this.sprite = this.randomSprite();
         this.offset = Background.ScreenW;
     }
 }
开发者ID:timfel,项目名称:dash,代码行数:10,代码来源:BackgroundSlice.cs


示例14: Update

        public override void Update(GameTimerEventArgs e)
        {
            if (VirtualThumbsticks.LeftThumbstick.Length() > 0.0f)
                PlayerShip.Thrust(VirtualThumbsticks.LeftThumbstick);
            else
                PlayerShip.Acceleration = Vector3.Zero;

            if (VirtualThumbsticks.RightThumbstick.Length() > 0.5f)
                PlayerShip.Fire(ref PlayerShip, VirtualThumbsticks.RightThumbstick);

            base.Update(e);
        }
开发者ID:ronforbes,项目名称:vectorarena_backup,代码行数:12,代码来源:ShipManager.cs


示例15: Update

        public void Update(GameTimerEventArgs e)
        {
            if (Active)
            {
                Velocity *= 0.9f;
                Position += Velocity;
                Color = new Color(Color.R - 3, Color.G - 3, Color.B - 3, Color.A - 1);

                Life--;
                if (Life <= 0)
                    Die();
            }
        }
开发者ID:ronforbes,项目名称:omega,代码行数:13,代码来源:Particle.cs


示例16: Update

        public void Update(GameTimerEventArgs e)
        {
            // Calculate the time/movement scalar for this entity
            timeScalar = (float)(e.ElapsedTime.TotalMilliseconds * 8d);

            // Update the player position based on the current velocity
            Position += new Vector2(Velocity.X * timeScalar, Velocity.Y * timeScalar);

            // Decrease the velocity for a slowdown effect
            Velocity *= 0.99f;

            BoundsCheck();
        }
开发者ID:JohanGl,项目名称:Moon,代码行数:13,代码来源:Star.cs


示例17: OnDraw

        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            scoreboardRenderer.Render();

            var device = SharedGraphicsDeviceManager.Current.GraphicsDevice;
            device.Clear(Color.CornflowerBlue);
            device.DepthStencilState = DepthStencilState.Default;
            device.RasterizerState = RasterizerState.CullCounterClockwise;
            gamePlay.Draw();

            spriteBatch.Begin();
            spriteBatch.Draw(scoreboardRenderer.Texture, scoreboardPosition, Color.White);
            spriteBatch.End();
        }
开发者ID:shreedharcva,项目名称:Windows-Phone-7-In-Action,代码行数:17,代码来源:GamePage.xaml.cs


示例18: Update

        public void Update(GameTimerEventArgs e)
        {
            animationHandler.Update();

            timeScalar = (float)e.ElapsedTime.TotalMilliseconds;

            var delta = new Vector2(0, (target.Y - Position.Y) * 0.01f);
            Position += delta * timeScalar;

            if (animationHandler.Animations[0].HasCompleted)
            {
                target = new Vector2(target.X, -Texture.Height);
            }
        }
开发者ID:JohanGl,项目名称:Moon,代码行数:14,代码来源:ChallengeCompleted.cs


示例19: Update

        public override void Update(GameTimerEventArgs e)
        {
            if (gameOver)
            {
                EnemyManager.KillEnemies();
                EnemyManager.Active = false;

                postgameTimer -= e.ElapsedTime;

                if (postgameTimer.TotalSeconds < 0)
                    EndScene = true;
            }

            AudioManager.PlaySong("ParticleFusion", true);

            base.Update(e);
        }
开发者ID:ronforbes,项目名称:vectorarena_backup,代码行数:17,代码来源:GameplayScene.cs


示例20: Draw

        public void Draw(GameTimerEventArgs gameTime, Rectangle square, Rectangle screen, SpriteBatch sb, Map map)
        {
            Point p;
            Point off;

            double factX = ((this.egg.getBounds().Width * 0.45) * (square.Width / 155.0));
            double factY = ((this.egg.getBounds().Height * 0.45) * (square.Height / 58.0));

            off.X = (this.pos.X + 1) * (square.Width / 2);
            off.Y = (this.pos.X) * (square.Height / 2);

            p.X = -this.pos.Y * (square.Width / 2) + off.X + square.X + ((int)map.getSize().Y - 1) * (square.Width / 2);
            p.Y = this.pos.Y * (square.Height / 2) + off.Y + square.Y - ((int)map.getSize().Y - 1) * (square.Height / 2);

            Rectangle tar = new Rectangle((int)(p.X + (int)(117 * (square.Width / 155.0))), (int)(p.Y + (int)(38 * (square.Height / 58.0))), (int)factX, (int)factY);
            if (screen.Intersects(tar))
                this.egg.Draw(sb, tar);
        }
开发者ID:fiahil,项目名称:Zappy,代码行数:18,代码来源:Egg.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Framework.GameWindow类代码示例发布时间:2022-05-26
下一篇:
C# Framework.GameTimer类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap