本文整理汇总了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 ) );
}
}
示例2: Update
public void Update(GameTimerEventArgs e)
{
// Calculate the time/movement scalar for this entity
timeScalar = (float)e.ElapsedTime.TotalMilliseconds;
Angle += 0.001f * timeScalar;
}
示例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);
}
示例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;
}
}
}
示例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);
}
}
示例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;
}
}
示例7: Update
public override void Update(GameTimerEventArgs e)
{
foreach (Multiplier m in Multipliers)
{
m.HandleCollisions();
}
base.Update(e);
}
示例8: Update
public override void Update(GameTimerEventArgs e)
{
foreach (Bullet b in Bullets)
{
b.HandleCollisions();
}
base.Update(e);
}
示例9: onUpdate
public void onUpdate(GameTimerEventArgs e)
{
if (wait) time += (float)e.ElapsedTime.TotalSeconds;
if (time > 0.5)
{
time = 0;
wait = false;
}
}
示例10: Update
public override void Update(GameTimerEventArgs e)
{
if (!ShipManager.PlayerShip.Alive)
{
gameOver = true;
}
base.Update(e);
}
示例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();
}
示例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);
}
}
}
示例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;
}
}
示例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);
}
示例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();
}
}