public static Tetromino GenerateRandomTetromino(PositionInfo initialPosition) { TetrominoShapeType shapeType = shapeTypes[randomNumberGenerator.Next(0, shapeTypes.Length)]; var tetromino = new Tetromino(initialPosition, shapeType); return(tetromino); }
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); }
public static Brush GetBrushByShapeType(TetrominoShapeType shapeType) { return(shapeTypeToBrushDict[shapeType]); }
public static bool[,] GetTetrominoMatrix(TetrominoShapeType shapeType) { return(shapeTypeToMatrixDict[shapeType]); }