public void Update(GameTime gameTime, Input current, Input previous) { cameraDeviceUpdateTimer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (!readFinished) { if (inCubeRotation) { targetAnimationTimer += (float)gameTime.ElapsedGameTime.TotalSeconds; UpdateCubeRotation(); } else { confirmReadedColors.Update(current, previous); } if (cameraDeviceUpdateTimer > cameraDevicesUpdateRate) { cameraDeviceUpdateTimer = 0; UpdateCameraDevices(); } scrambleButton.Update(current, previous); colorSelector.Update(current, previous); rubiksReadedColors.Update(current, previous); takeImageButton.Update(current, previous); } else { if (scrambleMode) { scrambleTimer += (float)gameTime.ElapsedGameTime.TotalSeconds; if (scrambleRate <= scrambleTimer) { scrambleTimer = 0; cube.Scramble(representedColors); scrambleRate *= 1.03f; } } if (setSolvePosition) { cube.AngleX = (Math.Abs(cube.AngleX) < 0.01f ? 0 : cube.AngleX + (cube.AngleX < 0 ? 0.01f : -0.01f)); cube.AngleY = (Math.Abs(cube.AngleY) < 0.01f ? 0 : cube.AngleY + (cube.AngleY < 0 ? 0.01f : -0.01f)); cube.AngleZ = (Math.Abs(cube.AngleZ) < 0.01f ? 0 : cube.AngleZ + (cube.AngleZ < 0 ? 0.01f : -0.01f)); if (cube.AngleX == 0 && cube.AngleY == 0 && cube.AngleZ == 0) { screenManager.PopScreen(); screenManager.PushScreen(new RubiksSolverScreen(cube)); } } else { UpdateFinishedCube(gameTime, current, previous); } } }