예제 #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();
    }
예제 #2
0
파일: GeoSink.cs 프로젝트: microbet/sizeup
 private void addPoint(double latitude, double longitude, double?z, double?m)
 {
     if (!invalidShape)
     {
         CurrentFigure.Add(projection.FromCoordinatesToPixel(new PointF((float)longitude, (float)latitude)));
     }
 }
예제 #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));
        }
예제 #4
0
 /// <summary>
 /// Closes the current <see cref="Figure{TPoint, TViewBounds}"/>.
 /// </summary>
 public void CloseFigure()
 {
     CurrentFigure.Close();
 }