private IPiece CreateRandom(object o) { IPiece ret = null; int n = random.Next(5); switch (n) { case 0: ret = new RectanglePiece(o); break; case 1: ret = new LinePiece(o); break; case 2: ret = new TPiece(o); break; case 3: ret = new LPiece(o); break; case 4: ret = new ZPiece(o); break; } return(ret); }
private BaseTetromino GeneratePiece(int i) { var pieceTypeToCreate = (PieceTypes)Game1.Random.Next(0, 7); var startPoint = new Point(-4, i * 4); BaseTetromino newPiece = null; switch (pieceTypeToCreate) { case PieceTypes.LL: newPiece = new LeftL(Content.Load <Texture2D>("NewPieces/LPiece"), startPoint, Color.Orange, Vector2.One, RotationOptions.NoRotation); break; case PieceTypes.RL: newPiece = new RightL(Content.Load <Texture2D>("NewPieces/RPiece"), startPoint, Color.Blue, Vector2.One, RotationOptions.NoRotation); break; case PieceTypes.T: newPiece = new TPiece(Content.Load <Texture2D>("NewPieces/TPiece"), startPoint, Color.Purple, Vector2.One, RotationOptions.NoRotation); break; case PieceTypes.LZZ: newPiece = new LeftZigZag(Content.Load <Texture2D>("NewPieces/LeftZigZag"), startPoint, Color.Green, Vector2.One, RotationOptions.NoRotation); break; case PieceTypes.RZZ: newPiece = new RightZigZag(Content.Load <Texture2D>("NewPieces/RightZigZag"), startPoint, Color.Red, Vector2.One, RotationOptions.NoRotation); break; case PieceTypes.Square: newPiece = new Square(Content.Load <Texture2D>("NewPieces/Square"), startPoint, Color.Yellow, Vector2.One, RotationOptions.NoRotation); break; case PieceTypes.Straight: newPiece = new StraightPiece(Content.Load <Texture2D>("NewPieces/StraightPiece"), startPoint, Color.LightBlue, Vector2.One, RotationOptions.NoRotation); break; } return(newPiece); }
private void PutMiniature(Type tetriminos, int[][] positions) { if (tetriminos == typeof(IPiece)) { IPiece.MiniaturePiece(positions); return; } if (tetriminos == typeof(JPiece)) { JPiece.MiniaturePiece(positions); return; } if (tetriminos == typeof(LPiece)) { LPiece.MiniaturePiece(positions); return; } if (tetriminos == typeof(OPiece)) { OPiece.MiniaturePiece(positions); return; } if (tetriminos == typeof(SPiece)) { SPiece.MiniaturePiece(positions); return; } if (tetriminos == typeof(TPiece)) { TPiece.MiniaturePiece(positions); return; } if (tetriminos == typeof(ZPiece)) { ZPiece.MiniaturePiece(positions); } }