Esempio n. 1
0
 void connectCube()
 {
     for (int i = 0; i < SELECTED_CUBE.Count; i++)
     {
         CubeController.Cube cube = SELECTED_CUBE [i].Me;
         SELECTED_CUBE [i].setRight(ArrayHelper.haveRightNeiboor(cube.rowId, cube.colId, CUBES, col));
         SELECTED_CUBE [i].setUp(ArrayHelper.haveUpNeiboor(cube.rowId, cube.colId, CUBES, row));
     }
 }
Esempio n. 2
0
 public static bool isSameColor(GameObject a, GameObject b)
 {
     if (!a.GetComponent <CubeController> () || !b.GetComponent <CubeController> ())
     {
         return(false);
     }
     CubeController.Cube ca = a.GetComponent <CubeController> ().Me;
     CubeController.Cube cb = b.GetComponent <CubeController> ().Me;
     return(ca.value == cb.value);
 }
Esempio n. 3
0
    void connectSame()
    {
        int cc = 0;

        for (int r = 0; r < row; r++)
        {
            for (int c = 0; c < col; c++)
            {
                if (r == row - 1 && c == col - 1)
                {
                    continue;
                }
                else
                {
                    if (c != col - 1)
                    {
                        if (CUBES [r, c].GetComponent <CubeController> ())
                        {
                            CubeController.Cube thisCube = CUBES [r, c].GetComponent <CubeController> ().Me;
                            if (thisCube.value == Define.bigValue)
                            {
                                continue;
                            }
                            if (CUBES [r, c + 1].GetComponent <CubeController> ())
                            {
                                CubeController.Cube rightCube = CUBES [r, c + 1].GetComponent <CubeController> ().Me;
                                if (thisCube.value == rightCube.value)
                                {
                                    CUBES [r, c].GetComponent <CubeController> ().setSameRight(true);
                                }
                            }
                        }
                    }
                    if (r != row - 1)
                    {
                        if (CUBES [r, c].GetComponent <CubeController> ())
                        {
                            CubeController.Cube thisCube = CUBES [r, c].GetComponent <CubeController> ().Me;
                            if (CUBES [r + 1, c].GetComponent <CubeController> ())
                            {
                                CubeController.Cube upCube = CUBES [r + 1, c].GetComponent <CubeController> ().Me;
                                if (thisCube.value == upCube.value)
                                {
                                    CUBES [r, c].GetComponent <CubeController> ().setSameUp(true);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Esempio n. 4
0
 public static bool isNearAndSame(CubeController.Cube a, CubeController.Cube b)
 {
     return(((a.rowId == b.rowId && Mathf.Abs(a.colId - b.colId) == 1) || (a.colId == b.colId && Mathf.Abs(a.rowId - b.rowId) == 1)) &&
            a.value == b.value);
 }