private void DrawRotatingPiece(int pixelX, int pixelY, string pieceName, SpriteBatch spriteBatch) { RotatingPiece p = _gameBoard.GetRotatingPiece(pieceName); Rectangle rect = new Rectangle( pixelX + (GamePiece.PieceWidth / 2), pixelY + (GamePiece.PieceHeight / 2), GamePiece.PieceWidth, GamePiece.PieceHeight ); Vector2 tileCenter = new Vector2(GamePiece.PieceWidth / 2, GamePiece.PieceHeight / 2); spriteBatch.Draw(_playingPieces, rect, p.GetSoruceRect(), Color.White, p.RotationAmount, tileCenter, SpriteEffects.None, 0); }
public void UpdateRotatingPieces() { Queue <string> keysToRemove = new Queue <string>(); foreach (string key in _rotatingPieces.Keys) { RotatingPiece p = _rotatingPieces[key]; p.UpdatePiece(); if (p.RotationTicksRemaining == 0) { keysToRemove.Enqueue(key); } } while (keysToRemove.Count > 0) { _rotatingPieces.Remove(keysToRemove.Dequeue()); } }