本文整理匯總了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();
}
}