Esempio n. 1
0
        public static Shape CreateShape(SKPointI point)
        {
            Shape shape;
            int   i = new Random().Next(7);

            if (i == 0)
            {
                shape = new ShapeI(point);
            }
            else if (i == 1)
            {
                shape = new ShapeJ(point);
            }
            else if (i == 2)
            {
                shape = new ShapeL(point);
            }
            else if (i == 3)
            {
                shape = new ShapeO(point);
            }
            else if (i == 4)
            {
                shape = new ShapeS(point);
            }
            else if (i == 5)
            {
                shape = new ShapeT(point);
            }
            else if (i == 6)
            {
                shape = new ShapeZ(point);
            }
            else
            {
                shape = new ShapeJ(point);
            }
            return(shape);
        }
Esempio n. 2
0
        /// <summary>
        /// Создание фигуры
        /// </summary>
        /// <returns>Фигуры</returns>
        public Shape CreateShape()
        {
            Shape currentShape = null;

            switch ((ShapeTypes)rnd.Next(7))
            {
            case ShapeTypes.TShape:
                currentShape = new ShapeT();
                break;

            case ShapeTypes.IShape:
                currentShape = new ShapeI();
                break;

            case ShapeTypes.JShape:
                currentShape = new ShapeJ();
                break;

            case ShapeTypes.LShape:
                currentShape = new ShapeL();
                break;

            case ShapeTypes.SquareShape:
                currentShape = new ShapeSquare();
                break;

            case ShapeTypes.SShape:
                currentShape = new ShapeS();
                break;

            case ShapeTypes.ZShape:
                currentShape = new ShapeZ();
                break;
            }
            return(currentShape);
        }