Exemplo n.º 1
0
    /// <summary>
    /// move figure downm generate new one and finish the game
    /// </summary>
    public void MoveFigureDown()
    {
        //move figure down by one
        var isFall = CurrentFigure.MoveDown(GameField);

        if (isFall == false)
        {
            //fill the field with the current figure
            foreach (var point in CurrentFigure.Position)
            {
                GameField[point.Y, point.X] = CurrentFigure.TypeOfCell;
            }

            //check for fill rows
            CheckForFilledRows();

            //change next and current figures, show it
            CurrentFigure = NextFigure;
            CurrentFigure.ChangeFigurePosition += InvokeRefresh;
            NextFigure = FigureGenerator.Generate(_startColumn);

            ChangedNextFigure.Invoke();
            ChangedGameField.Invoke();

            //check for end of game(can't insert figure in game field)
            var isEnd = CurrentFigure.IsCorrect(GameField);
            if (isEnd == false)
            {
                OnEndOfGame.Invoke();
            }
        }

        ChangedGameField.Invoke();
    }
Exemplo n.º 2
0
 private void addPoint(double latitude, double longitude, double?z, double?m)
 {
     if (!invalidShape)
     {
         CurrentFigure.Add(projection.FromCoordinatesToPixel(new PointF((float)longitude, (float)latitude)));
     }
 }
Exemplo n.º 3
0
        public void Draw(object sender, EventArgs e)
        {
            Bitmap   bitmap = new Bitmap(Size.Width, Size.Height);
            Graphics gi     = Graphics.FromImage(bitmap);

            InitGrid();
            gi.Clear(BackColor);
            CurrentFigure.Draw(gi);
            foreach (var block in Lying)
            {
                block.Draw(gi);
            }
            Graphics.DrawImage(bitmap, new Point(0, 0));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Closes the current <see cref="Figure{TPoint, TViewBounds}"/>.
 /// </summary>
 public void CloseFigure()
 {
     CurrentFigure.Close();
 }