/// <summary> /// 初始化墙壁 /// </summary> private void InitWall() { while (!pc.percolates()) { int row = Random.Range(1, rows); int col = Random.Range(1, cols); pc.open(row, col); } for (int x = 1; x < cols; x++) { for (int y = 1; y < rows; y++) { if (!pc.isOpen(y, x)) { GameObject wallGo = GameObject.Instantiate(wall); wallGo.transform.position = new Vector3(x - .5f, y - .5f); wallGo.transform.SetParent(mapHolder); } } } }
public bool IsOpen(int x, int y) { return(mapPercolation.isOpen(x, y)); }