Exemple #1
0
    public override void RotateCounterClockwise <UpFace, BackFace, DownFace, FrontFace>(UpFace Up, BackFace Back, DownFace Down, FrontFace Front)
    {
        Commands.rotating = true;
        this.direction    = Vector3.left;
        this.clockwise    = false;
        this.rotate       = true;

        List <Transform> intUp    = Cublets.Intersect(Up.Cublets).ToList();
        List <Transform> intBack  = Cublets.Intersect(Back.Cublets).ToList();
        List <Transform> intDown  = Cublets.Intersect(Down.Cublets).ToList();
        List <Transform> intFront = Cublets.Intersect(Front.Cublets).ToList();

        Back.Cublets.RemoveAll(_ => intBack.Contains(_));
        Back.Cublets.AddRange(intDown);

        Down.Cublets.RemoveAll(_ => intDown.Contains(_));
        Down.Cublets.AddRange(intFront);

        Front.Cublets.RemoveAll(_ => intFront.Contains(_));
        Front.Cublets.AddRange(intUp);

        Up.Cublets.RemoveAll(_ => intUp.Contains(_));
        Up.Cublets.AddRange(intBack);
    }
Exemple #2
0
    public override void RotateCounterClockwise <UpFace, LeftFace, DownFace, RightFace>(UpFace Up, LeftFace Left, DownFace Down, RightFace Right)
    {
        Commands.rotating = true;
        this.direction    = Vector3.back;
        this.clockwise    = false;
        this.rotate       = true;

        List <Transform> intUp    = Cublets.Intersect(Up.Cublets).ToList();
        List <Transform> intRight = Cublets.Intersect(Right.Cublets).ToList();
        List <Transform> intDown  = Cublets.Intersect(Down.Cublets).ToList();
        List <Transform> intLeft  = Cublets.Intersect(Left.Cublets).ToList();

        Right.Cublets.RemoveAll(_ => intRight.Contains(_));
        Right.Cublets.AddRange(intUp);

        Down.Cublets.RemoveAll(_ => intDown.Contains(_));
        Down.Cublets.AddRange(intRight);

        Left.Cublets.RemoveAll(_ => intLeft.Contains(_));
        Left.Cublets.AddRange(intDown);

        Up.Cublets.RemoveAll(_ => intUp.Contains(_));
        Up.Cublets.AddRange(intLeft);
    }
Exemple #3
0
    public override void RotateCounterClockwise <FrontFace, RigthFace, BackFace, LeftFace>(FrontFace Front, RigthFace Right, BackFace Back, LeftFace Left)
    {
        Commands.rotating = true;
        this.direction    = Vector3.down;
        this.clockwise    = false;
        this.rotate       = true;

        List <Transform> intFront = Cublets.Intersect(Front.Cublets).ToList();
        List <Transform> intLeft  = Cublets.Intersect(Left.Cublets).ToList();
        List <Transform> intBack  = Cublets.Intersect(Back.Cublets).ToList();
        List <Transform> intRight = Cublets.Intersect(Right.Cublets).ToList();

        Left.Cublets.RemoveAll(_ => intLeft.Contains(_));
        Left.Cublets.AddRange(intFront);

        Back.Cublets.RemoveAll(_ => intBack.Contains(_));
        Back.Cublets.AddRange(intLeft);

        Right.Cublets.RemoveAll(_ => intRight.Contains(_));
        Right.Cublets.AddRange(intBack);

        Front.Cublets.RemoveAll(_ => intFront.Contains(_));
        Front.Cublets.AddRange(intRight);
    }