Пример #1
0
        public void RotateCCW()
        {
            if (this.game_end)
            {
                return;
            }
            Tetromino f    = this.minos.First();
            int       left = f.GetLeft();

            f.RotateCW();
            bool revert = false;

            foreach (System.Drawing.Rectangle r in this.minos.First().GetRectangles(0, 0))
            {
                int x = r.X / this.scale;
                int y = r.Y / this.scale;
                if (x >= 0 && x < 10 && y >= 0 && y < 20)
                {
                    revert |= this.grid[x, y].Color != System.Drawing.Color.FromArgb(128, 255, 255, 255);
                }
            }
            if (revert)
            {
                f.RotateCCW();
                int displacement = left - f.GetLeft();
                f.SetStart(displacement, 0);
            }
        }