public static Tetromino GenerateRandomTetromino(PositionInfo initialPosition)
        {
            TetrominoShapeType shapeType = shapeTypes[randomNumberGenerator.Next(0, shapeTypes.Length)];
            var tetromino = new Tetromino(initialPosition, shapeType);

            return(tetromino);
        }
예제 #2
0
 public Tetromino(PositionInfo topLeft, TetrominoShapeType shapeType, Brush color = null)
 {
     this.topLeft       = topLeft;
     this.shapeType     = shapeType;
     this.brush         = color != null ? color : TetrominoBrushesCache.GetBrushByShapeType(shapeType);
     this.bodyMatrix    = TetrominoPositionMatricesCache.GetTetrominoMatrix(shapeType);
     this.bodyPositions = GetPositions(this.topLeft, this.bodyMatrix);
 }
예제 #3
0
 public static Brush GetBrushByShapeType(TetrominoShapeType shapeType)
 {
     return(shapeTypeToBrushDict[shapeType]);
 }
 public static bool[,] GetTetrominoMatrix(TetrominoShapeType shapeType)
 {
     return(shapeTypeToMatrixDict[shapeType]);
 }