internal static FiguresAngle GetNextFigureAngleEnumValue(FiguresAngle e) { Array all = FiguresAngle.GetValues(e.GetType()); int i = Array.IndexOf(all, e); if ((i >= all.Length - 1) || (i < 0)) { return((FiguresAngle)all.GetValue(0)); } return((FiguresAngle)all.GetValue(i + 1)); }
internal bool CanRotateRight(FiguresTypes figureType, FiguresAngle figureAngle, int centerX, int centerY) { int rowNumber = (int)figureAngle + 1; if (rowNumber > 3) { rowNumber = 0; } int FigureTypeRowInList = (int)figureType; var figure_row = FigureCoordinates.Coordinates[FigureTypeRowInList][rowNumber]; int nextX = 88; int nextY = 88; switch (BoxIndex) { case 0: nextX = centerX + figure_row.Item1.X; nextY = centerY + figure_row.Item1.Y; break; case 1: nextX = centerX + figure_row.Item2.X; nextY = centerY + figure_row.Item2.Y; break; case 2: nextX = centerX + figure_row.Item3.X; nextY = centerY + figure_row.Item3.Y; break; case 3: nextX = centerX + figure_row.Item4.X; nextY = centerY + figure_row.Item4.Y; break; } return(TetrisArray.Array2DValue(nextX, nextY) == 0); }
internal void RotateRight(FiguresTypes figureType, FiguresAngle figureAngle, int x, int y) { int rowNumber = (int)figureAngle + 1; if (rowNumber > 3) { rowNumber = 0; } int FigureTypeRowInList = (int)figureType; var figure_row = FigureCoordinates.Coordinates[FigureTypeRowInList][rowNumber]; switch (BoxIndex) { case 0: X = x + figure_row.Item1.X; Y = y + figure_row.Item1.Y; break; case 1: X = x + figure_row.Item2.X; Y = y + figure_row.Item2.Y; break; case 2: X = x + figure_row.Item3.X; Y = y + figure_row.Item3.Y; break; case 3: X = x + figure_row.Item4.X; Y = y + figure_row.Item4.Y; break; } Render(); }