public void TryStartRotate(CubeLayerCriteria layer, bool positive)
 {
     if (State == ControllerState.Shuffling)
     {
         return;
     }
     _cube.TryStartAutoRotate(layer, positive);
 }
示例#2
0
 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);
 }
示例#4
0
 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);
 }
示例#5
0
 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;
 }
示例#6
0
 private void tryStartRotate(CubeLayerCriteria layer, bool positive)
 {
     if (_autoRotateMode)
     {
         _cube.TryStartAutoRotate(layer, positive);
     }
     else
     {
         if (_cube.TryEnterFreeRotationMode(layer, positive))
         {
             _lastMousePosition = Mouse.GetState().Position;
         }
     }
 }
示例#7
0
 public LayerControlKey(Keys key, CubeLayerCriteria layer)
 {
     Key   = key;
     Layer = layer;
 }