public void Draw(GameTime gameTime, Rectangle rectangle, float Rotation, Color color) { if (loaded) { if (!Animated) { X.spriteBatch.Draw(texture, rectangle, Color.White); } else { if (timer.PassedTime > AnimationTime && IsRunning) { timer.Reset(); timer.Start(); if (CurrentCell < TotalCells - 1) { CurrentCell++; } else { CurrentCell = 0; } } X.spriteBatch.Draw(texture, rectangle, new Rectangle( cells[CurrentCell].Column * cells[CurrentCell].CellWidth, cells[CurrentCell].Row * cells[CurrentCell].CellWidth, cells[CurrentCell].CellWidth, cells[CurrentCell].CellHeight ), color, Rotation, new Vector2(texture.Width / 2, texture.Height / 2), SpriteEffects.None, 0); } } }
public override void Update(ref GameTime gameTime) { LastState = CurrentState; CurrentState = Mouse.GetState(); CurrentPosition = new Vector2(CurrentState.X, CurrentState.Y); if (Reset) { Delta = InitialPosition - CurrentPosition; } else { Delta = CurrentPosition - new Vector2(LastState.X, LastState.Y); } if (Reset) { Mouse.SetPosition((int)InitialPosition.X, (int)InitialPosition.Y); } ScrollPosition = CurrentState.ScrollWheelValue; ScrollDelta = ScrollPosition - LastState.ScrollWheelValue; if (CurrentState == LastState) { idleTime.Start(); } else { idleTime.Reset(); } }
public void Rumble(float Left, float Right, float Time, GameTime gameTime) { left = Left; right = Right; length = Time; GamePad.SetVibration(index, Left, Right); vibrationTimer.Start(); }
public override void Update(ref GameTime gameTime) { UpdateStates(); if (CurrentState == LastState) { idleTime.Start(); } else { idleTime.Reset(); } }
public override void Update(ref GameTime gameTime) { GetState(); if (CurrentState == LastState) { idleTime.Start(); } else { idleTime.Reset(); } if (vibrationTimer.PassedTime > length) { vibrationTimer.Reset(); left = 0; right = 0; length = 0; GamePad.SetVibration(index, 0, 0); } }
public void Start() { IsStopped = false; CurrentFrame = 0; Timer.Start(); }