Beispiel #1
0
        private static void UpdatePos(SimpleCube SimCubeInstance)
        {
            int currPosX = SimCubeInstance.getPosX;
            int currPosY = SimCubeInstance.getPosY;

            SimpleCube[] ArrConj = SimCubeInstance.getConj;
            for (int i = 0; i < 4; i++)
            {
                if (ArrConj[i] != null)
                {
                    switch (i)
                    {
                    case 0:
                        ArrConj[0].SetPos(currPosX - 1, currPosY);
                        break;

                    case 1:
                        ArrConj[1].SetPos(currPosX, currPosY - 1);
                        break;

                    case 2:
                        ArrConj[2].SetPos(currPosX + 1, currPosY);
                        break;

                    case 3:
                        ArrConj[3].SetPos(currPosX, currPosY + 1);
                        break;
                    }
                    UpdatePos(ArrConj[i]);
                }
            }
        }
Beispiel #2
0
 public void SetConj(SimpleCube left = null, SimpleCube up = null, SimpleCube right = null, SimpleCube down = null)
 {
     GetConj[0] = left;
     GetConj[1] = up;
     GetConj[2] = right;
     GetConj[3] = down;
 }
Beispiel #3
0
        protected void findCentralCube()
        {
            int i = 0;

            if (cubes != null)
            {
                while (!cubes[i++].isCentral)
                {
                }
            }
            centralCube = cubes[--i];
        }
Beispiel #4
0
        public static SimpleCube[] GetPartDefinition(Definition name)
        {
            //initializetion probl ** Graph
            SimpleCube[] tetraPart = new SimpleCube[4];
            for (int i = 1; i < 4; i++)
            {
                tetraPart[i] = new SimpleCube();
            }
            tetraPart[0] = new SimpleCube(0, 0);
            switch (name)
            {
            case Definition.ODetail:
                tetraPart[0].SetConj(null, null, tetraPart[1]);
                tetraPart[1].SetConj(null, null, null, tetraPart[2]);
                tetraPart[2].SetConj(tetraPart[3]);
                break;

            case Definition.Detail:
                tetraPart[0].SetConj(tetraPart[1], null, tetraPart[2]);
                tetraPart[2].SetConj(null, null, tetraPart[3]);
                break;

            case Definition.T_Detail:
                tetraPart[0].SetConj(tetraPart[1], tetraPart[2], tetraPart[3]);
                break;

            case Definition.JDetail:
                tetraPart[0].SetConj(tetraPart[1], null, tetraPart[2]);
                tetraPart[1].SetConj(null, tetraPart[3]);
                break;

            case Definition.LDetail:
                tetraPart[0].SetConj(tetraPart[1], null, tetraPart[2]);
                tetraPart[2].SetConj(null, tetraPart[3]);
                break;

            case Definition.SDetail:
                tetraPart[0].SetConj(tetraPart[1], tetraPart[2]);
                tetraPart[2].SetConj(null, null, tetraPart[3]);
                break;

            case Definition.ZDetail:
                tetraPart[0].SetConj(null, tetraPart[1], tetraPart[2]);
                tetraPart[1].SetConj(tetraPart[3]);
                break;

            default:
                return(null);
            }
            return(tetraPart);
        }
        public static SimpleCube[] GetPartDefinition(Part.Definition name)
        {
            //initializetion probl ** Graph
            SimpleCube[] TetraPart = new SimpleCube[4];
            for (int i = 1; i < 4; i++)
            {
                TetraPart[i] = new SimpleCube();
            }
            TetraPart[0] = new SimpleCube(0, 0);
            switch (name)
            {
            case Part.Definition.O_Detail:
                TetraPart[0].SetConj(null, null, TetraPart[1]);
                TetraPart[1].SetConj(null, null, null, TetraPart[2]);
                TetraPart[2].SetConj(TetraPart[3]);
                break;

            case Part.Definition.I_Detail:
                TetraPart[0].SetConj(TetraPart[1], null, TetraPart[2]);
                TetraPart[2].SetConj(null, null, TetraPart[3]);
                break;

            case Part.Definition.T_Detail:
                TetraPart[0].SetConj(TetraPart[1], TetraPart[2], TetraPart[3]);
                break;

            case Part.Definition.J_Detail:
                TetraPart[0].SetConj(TetraPart[1], null, TetraPart[2]);
                TetraPart[1].SetConj(null, TetraPart[3]);
                break;

            case Part.Definition.L_Detail:
                TetraPart[0].SetConj(TetraPart[1], null, TetraPart[2]);
                TetraPart[2].SetConj(null, TetraPart[3]);
                break;

            case Part.Definition.S_Detail:
                TetraPart[0].SetConj(TetraPart[1], TetraPart[2]);
                TetraPart[2].SetConj(null, null, TetraPart[3]);
                break;

            case Part.Definition.Z_Detail:
                TetraPart[0].SetConj(null, TetraPart[1], TetraPart[2]);
                TetraPart[1].SetConj(TetraPart[3]);
                break;

            default:
                return(null);
            }
            return(TetraPart);
        }
Beispiel #6
0
 // true - clockwise right
 // false - clockwise left
 public void Rotate(bool direction)
 {
     if (direction)
     {
         SimpleCube tmpCube = GetConj[GetConj.Length - 1];
         Array.Copy(GetConj, 0, GetConj, 1, GetConj.Length - 1);
         GetConj[0] = tmpCube;
     }
     else
     {
         SimpleCube tmpCube = GetConj[0];
         Array.Copy(GetConj, 1, GetConj, 0, GetConj.Length - 1);
         GetConj[GetConj.Length - 1] = tmpCube;
     }
 }
Beispiel #7
0
 // true - clockwise right
 // false - clockwise left
 public void Rotate(bool direction)
 {
     if (direction)
     {
         SimpleCube tmpCube = Conj[Conj.Length - 1];
         Array.Copy(Conj, 0, Conj, 1, Conj.Length - 1);
         Conj[0] = tmpCube;
     }
     else
     {
         SimpleCube tmpCube = Conj[0];
         Array.Copy(Conj, 1, Conj, 0, Conj.Length - 1);
         Conj[Conj.Length - 1] = tmpCube;
     }
 }
 public SimpleCubeUnity(SimpleCube mainCube, GameObject cube)
 {
     this.mainCube = mainCube;
     this.Cube     = cube;
 }