コード例 #1
0
ファイル: PieceQueue.cs プロジェクト: desktopgame/Tetris
        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);
        }
コード例 #2
0
 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);
     }
 }