public void TryStartRotate(CubeLayerCriteria layer, bool positive) { if (State == ControllerState.Shuffling) { return; } _cube.TryStartAutoRotate(layer, positive); }
public Cube(Square[] squares) { _squares = squares; ActiveLayer = CubeLayerCriteria.Get(Axis.X, AxisLandmark.Max); State = CubeState.Ready; _autoTween = new Tween(Easing.CubicOut, 0, val => FreeRotateTotalAngle = val, MathHelper.PiOver2, 0.25f); _snapTween = new Tween(Easing.CubicOut, 0, val => FreeRotateTotalAngle = val, 0, 0.125f); }
private void tryNextShuffleMove() { if (_shuffleMovesLeft <= 0) { State = ControllerState.Ready; return; } _shuffleMovesLeft--; _cube.TryStartAutoRotate(CubeLayerCriteria.GetRandom(), _random.Next(0, 100) > 50); }
public bool TryEnterFreeRotationMode(CubeLayerCriteria layer, bool positive = true) { if (State != CubeState.Ready && FreeRotateTotalAngle != 0) { return(false); } RotatePositive = positive; _broadcastMoves = true; ActiveLayer = layer; State = CubeState.FreeRotating; return(true); }
public void TryStartAutoRotate(CubeLayerCriteria layer, bool positive = true, bool broadcast = true) { if (State != CubeState.Ready && FreeRotateTotalAngle != 0) { return; } _broadcastMoves = broadcast; RotatePositive = positive; _autoTween.Reset(); _autoTween.SetTargetValue((positive ? 1 : -1) * MathHelper.PiOver2); ActiveLayer = layer; State = CubeState.AutoRotating; }
private void tryStartRotate(CubeLayerCriteria layer, bool positive) { if (_autoRotateMode) { _cube.TryStartAutoRotate(layer, positive); } else { if (_cube.TryEnterFreeRotationMode(layer, positive)) { _lastMousePosition = Mouse.GetState().Position; } } }
public LayerControlKey(Keys key, CubeLayerCriteria layer) { Key = key; Layer = layer; }