public void searchRow(int x, int y) { boxSettings cxcy = map[x, y].GetComponent <boxSettings>(); point p, p2; int flag = 0, flag2 = 0; p.x = x; p.y = y; p2.x = save.cx; p2.y = save.cy; int find = around.IndexOf(p); if (find == -1) { around = getAroundBlocks(p); save = cxcy; } else { int id = save.index; save.index = cxcy.index; cxcy.index = id; flag = testBlockMatch(p, cxcy.index); flag2 = testBlockMatch(p2, save.index); if (flag == 1 || flag2 == 1) { id = save.index; save.index = cxcy.index; cxcy.index = id; } around.Clear(); } }
// Update is called once per frame void Update() { boxSettings cxcy = new boxSettings(); point p; for (int x = 0; x < col; x++) { for (int y = 0; y < row; y++) { cxcy = map[x, y].GetComponent <boxSettings>(); p.x = x; p.y = y; testBlockMatch(p, cxcy.index); } } MoverDown(); }
void createGameArea() { float dx = 1.1f, dy = 1.1f; Vector3 myPose = new Vector3(-6, -2, -3); for (int yy = 0; yy < row; yy++) { for (int xx = 0; xx < col; xx++) { map[xx, yy] = Instantiate(box, myPose, Quaternion.identity) as GameObject; myPose.x += dx; boxSettings cxcy = map[xx, yy].GetComponent <boxSettings>(); cxcy.cx = xx; cxcy.cy = yy; cxcy.myMainGame = this.gameObject; } myPose.y += dy; myPose.x = -6; } }