示例#1
0
文件: Field.cs 项目: dawbit/Tetris
        public int Figure_down()
        {
            try
            {
                //for (int j = 0; j < figure.Check_floor().Length; j++)
                //{
                //    Single_pixel[figure.Check_floor()[j], figure.Check_floor()[j + 1]].Change_color(Single_pixel[figure.Check_floor()[j], figure.Check_floor()[j + 1]].Get_color());
                //    j++;
                //}
                for (int l = 0; l < figure.Check_floor().Length; l++)
                {
                    if (Single_pixel[figure.Check_floor()[l], figure.Check_floor()[l + 1]].Get_color() != Background_Color)
                    {
                        stop_falling = true;
                    }
                    l++;
                }
                if (stop_falling == false)
                {
                    for (int i = 0; i < figure.Coordinate().Length; i++)
                    {
                        Single_pixel[figure.Coordinate()[i], figure.Coordinate()[i + 1]].Change_color(Background_Color);
                        i++;
                    }
                    figure.Coordinates_down();

                    for (int i = 0; i < figure.Coordinate().Length; i++)
                    {
                        Single_pixel[figure.Coordinate()[i], figure.Coordinate()[i + 1]].Change_color(tertimino_color);
                        i++;
                    }
                }
                else
                {
                    stop_falling = false;
                    Line_by_line();
                    Draw_Tertimino();
                }
            }
            catch (System.IndexOutOfRangeException)
            {
                Line_by_line();
                Draw_Tertimino();
            }

            return(Score);
        }