Esempio n. 1
0
        public Cube MoveRow(int rowIndex, XMovement rotation)
        {
            if (size % 2 == 1 && rowIndex == size / 2)
            {
                throw new ArgumentException("RowIndex cannot be central if cube is uneven sized");
            }
            int next     = rotation == XMovement.Left ? left : right;
            int previous = 5 - next;

            if (rowIndex == 0)
            {
                if (rotation == XMovement.Left)
                {
                    faces[up].RotateClockwise();
                }
                else
                {
                    faces[up].RotateCounterClockwise();
                }
            }
            if (rowIndex == size - 1)
            {
                if (rotation == XMovement.Left)
                {
                    faces[up].RotateCounterClockwise();
                }
                else
                {
                    faces[up].RotateClockwise();
                }
            }

            SwapRow(faces[center], rowIndex, faces[next]);
            SwapRow(faces[opposite], rowIndex, faces[opposite]);
            SwapRow(faces[center], rowIndex, faces[opposite]);
            return(this);
        }
Esempio n. 2
0
 private void Start()
 {
     xMover    = new XMovement(xSpeed);
     dashMover = new DashMovement(dashForce, dashBlockTime, dashWaitInputTime);
     jumper    = new Jumper(jumpForce, maxSequentJumps, groundChecker, OnJumpPerformed, OnGround);
 }