private void On_ConfirmColors(object sender, EventArgs e) { inCubeRotation = true; targetAnimationTimer = 0; Color[,] clrs = readedColors; switch (currentSideToSet) { case CubeSide.Front: clrs = readedColors.FlipHorisontally().RotateClockwise(1); targetAngleY = -MathHelper.PiOver2; break; case CubeSide.Right: clrs = readedColors.FlipHorisontally().RotateClockwise(2); targetAngleY = -MathHelper.Pi; break; case CubeSide.Top: clrs = readedColors.FlipHorisontally().RotateClockwise(3); targetAngleY = -MathHelper.Pi - MathHelper.PiOver2; break; case CubeSide.Left: clrs = readedColors.RotateClockwise(3); targetAngleY = -MathHelper.Pi - MathHelper.Pi; break; case CubeSide.Back: clrs = readedColors.RotateClockwise(1); targetAngleY = -MathHelper.Pi; targetAngleX = MathHelper.PiOver2; break; case CubeSide.Bottom: clrs = readedColors.RotateClockwise(3); targetAngleX = 0; break; default: throw new Exception("Not a side"); } cube.SetSideColor(currentSideToSet, clrs); switch (currentSideToSet) { case CubeSide.Front: currentSideToSet = CubeSide.Right; break; case CubeSide.Right: currentSideToSet = CubeSide.Back; break; case CubeSide.Top: currentSideToSet = CubeSide.Left; break; case CubeSide.Left: currentSideToSet = CubeSide.Bottom; break; case CubeSide.Back: currentSideToSet = CubeSide.Top; break; case CubeSide.Bottom: //RotationCompleted readFinished = true; System.Windows.Forms.Control.FromHandle(GameEngine.WindowPtr).Controls.Clear(); break; default: break; } colorSelector.Show = false; rubiksReadedColors.UnmarkAll(); }