Esempio n. 1
0
 /// <summary>
 /// Поворот фигуры
 /// </summary>
 public void Turn()
 {
     MyGraphics.EraseFigure(figure, form.splitContainer1.Panel2);
     figure.Turn();
     MyGraphics.DrawCells(neighborsList, form.splitContainer1.Panel2);
     MyGraphics.DrawFigure(figure, form.splitContainer1.Panel2);
     neighborsList = figure.CheckNeighboringCells();
 }
Esempio n. 2
0
        /// <summary>
        /// Ход вправо
        /// </summary>
        public void MoveRight()
        {
            if (figure.CanMoveRight())
            {
                MyGraphics.EraseFigure(figure, form.splitContainer1.Panel2);
                figure.MoveRight();
                MyGraphics.DrawCells(neighborsList, form.splitContainer1.Panel2);
                MyGraphics.DrawFigure(figure, form.splitContainer1.Panel2);

                neighborsList = figure.CheckNeighboringCells();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Падение
        /// </summary>
        public void Fall()
        {
            if (!figure.CanFall())
            {
                FreezeFigure();

                int[] coordinatesForDel = CheckFilling().ToArray();

                if (coordinatesForDel.Length > 0)
                {
                    for (int i = 0; i < coordinatesForDel.Length; i++)
                    {
                        ChangeCoordinates(coordinatesForDel[i]);
                        IncreaseScore?.Invoke(Events.DeleteRows);
                    }

                    MyGraphics.ClearCells(form.splitContainer1.Panel2);
                    MyGraphics.DrawCells(form.splitContainer1.Panel2);
                    neighborsList.Clear();
                }
                else
                {
                    IncreaseScore?.Invoke(Events.Fall);
                }

                figure = Figure.CreateFigure(figureName);

                CheckEndGame();
            }
            else
            {
                MyGraphics.EraseFigure(figure, form.splitContainer1.Panel2);
                figure.Fall();
                MyGraphics.DrawCells(neighborsList, form.splitContainer1.Panel2);
                MyGraphics.DrawFigure(figure, form.splitContainer1.Panel2);

                neighborsList = figure.CheckNeighboringCells();
            }
        }