Exemple #1
0
        public ThreeByThreeCubeFace(CubeRow topRow, CubeRow middleRow, CubeRow bottomRow)
            : base(new List <CubeRow>() { topRow, middleRow, bottomRow })
        {
            if (topRow == null)
            {
                throw new ArgumentNullException(nameof(topRow));
            }

            if (middleRow == null)
            {
                throw new ArgumentNullException(nameof(middleRow));
            }

            if (bottomRow == null)
            {
                throw new ArgumentNullException(nameof(bottomRow));
            }

            if (topRow.Facelets.Count != Size)
            {
                throw new ArgumentException(InvlaideRowMessage, nameof(topRow));
            }

            if (middleRow.Facelets.Count != Size)
            {
                throw new ArgumentException(InvlaideRowMessage, nameof(middleRow));
            }

            if (bottomRow.Facelets.Count != Size)
            {
                throw new ArgumentException(InvlaideRowMessage, nameof(bottomRow));
            }
        }
Exemple #2
0
        public static CubeRow Reverse(this CubeRow row)
        {
            var clonedRow        = row.DeepClone();
            var reversedFacelets = clonedRow.Facelets.Reverse();

            return(new CubeRow(reversedFacelets.ToList()));
        }
Exemple #3
0
        public RowViewModel(CubeRow row)
        {
            this.row = row;
            Facelets = new List <FacletViewModel>();

            foreach (var faclet in row.Facelets)
            {
                Facelets.Add(new FacletViewModel(faclet));
            }
        }
Exemple #4
0
        public void AddCubeRow(int row)
        {
            // create cube row
            var cubeRow = new CubeRow(row);

            // set y position
            cubeRow.PositionY = (lastCubeRow == null)
                ? GameConfig.FIRST_ROW_INITIAL_POSITION_Y
                : lastCubeRow.PositionY - GameConfig.CUBE_HEIGHT * 0.75f;

            // add cube row to tree and dictionary
            this.AddChild(cubeRow);
            cubeRowsDict[cubeRow.Row] = cubeRow;

            // generate cubes and start motion if necessary
            cubeRow.CreateCubes();

            // keep track of last cube row
            lastCubeRow = cubeRow;
        }
Exemple #5
0
 public override void RotateCounterClockwise(CubeRow topRow, CubeRow bottomRow, CubeRow leftRow, CubeRow rightRow)
 {
     MapFaceRotation(Size, RotateFaceCounterClockwise);
     RotateRowsOfAdjacentFacesCounterClockwise(topRow, bottomRow, leftRow, rightRow);
 }