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


C# Framework.GameTimerEventArgs类代码示例

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


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


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