//public void SetNeighbor(CubeAdjacentDirection direction,CubeCell cell) //{ // neighbors[(int)direction] = cell; // cell.neighbors[(int)direction.CubeOpposite()] = this; //} //public CubeCell GetNeighbor(CubeAdjacentDirection direction) //{ // return neighbors[(int)direction]; //} //void Refresh() //{ // if(chunk) // { // chunk.Refresh(); // for(int i=0;i<neighbors.Length;i++) // { // CubeCell neighbor = neighbors[i]; // if(neighbor&&neighbor.chunk!=chunk) // { // neighbor.chunk.Refresh(); // } // } // } //} public bool CanHideSurface(CubeSurface surface) { //前后左右 if ((int)surface < 4) { int tempOrentate = ((int)surface - (int)orientate) < 0? ((int)surface - (int)orientate) + 4: ((int)surface - (int)orientate); switch (tempOrentate) { case 0: return(neighbors[0]); case 1: return(neighbors[3]); case 2: return(neighbors[6]); case 3: return(neighbors[9]); default: return(false); } }//上 else if ((int)surface == 4) { return(neighbors[12]); } else//下 { return(neighbors[13]); } }
void TriangulateCubeSurface(Vector3[] temp, CubeSurface surfaceTo, CubeData data) { float uCoordinate = ((int)surfaceTo * 1.0f) / 6.0f; float vCoordinate = ((int)data.type * 1.0f) / 16f * 1.0f; Vector2 uvBasePoint = new Vector2(uCoordinate, vCoordinate); switch (surfaceTo) { case CubeSurface.up: mesh.AddQuad(temp[0], temp[1], temp[2], temp[3]); break; case CubeSurface.down: mesh.AddQuad(temp[5], temp[4], temp[7], temp[6]); break; case CubeSurface.left: mesh.AddQuad(temp[0], temp[3], temp[7], temp[4]); break; case CubeSurface.right: mesh.AddQuad(temp[2], temp[1], temp[5], temp[6]); break; case CubeSurface.front: mesh.AddQuad(temp[1], temp[0], temp[4], temp[5]); break; case CubeSurface.back: mesh.AddQuad(temp[3], temp[2], temp[6], temp[7]); break; } mesh.AddQuadUV(uvBasePoint, 16); }
/// <summary> /// Returns a list of all of the cubies of a cube surface /// </summary> /// <param name="surface">the cube surface</param> /// <returns>List of the cubies of the cube surface</returns> private List <Cubie> getCubeSurface(CubeSurface surface) { List <Cubie> cubies; switch (surface) { case CubeSurface.Front: cubies = this.cubies.Where(q => q.PosX == 1).ToList(); break; case CubeSurface.Back: cubies = this.cubies.Where(q => q.PosX == -1).ToList(); break; case CubeSurface.Left: cubies = this.cubies.Where(q => q.PosY == -1).ToList(); break; case CubeSurface.Right: cubies = this.cubies.Where(q => q.PosY == 1).ToList(); break; case CubeSurface.Top: cubies = this.cubies.Where(q => q.PosZ == 1).ToList(); break; case CubeSurface.Bottom: cubies = this.cubies.Where(q => q.PosZ == -1).ToList(); break; case CubeSurface.MiddleHorizontal: cubies = this.cubies.Where(q => q.PosZ == 0).ToList(); break; case CubeSurface.MiddleVertical: cubies = this.cubies.Where(q => q.PosY == 0).ToList(); break; case CubeSurface.MiddleCircular: cubies = this.cubies.Where(q => q.PosX == 0).ToList(); break; default: cubies = null; break; } return(cubies); }
void TriangualteCubeSurface(Vector3[] vertices, CubeSurface surfaceTo, CubeData data) { float uCoordinate = ((int)surfaceTo * 1.0f) / 6.0f; float vCoordinate = ((int)data.type * 1.0f) / 16f * 1.0f; Vector2 uvBasePoint = new Vector2(uCoordinate, vCoordinate); CubeMesh mesh = data.isTransparent ? plan : terrain; switch (surfaceTo) { case CubeSurface.up: mesh.AddQuad(vertices[0], vertices[1], vertices[2], vertices[3]); break; case CubeSurface.down: mesh.AddQuad(vertices[5], vertices[4], vertices[7], vertices[6]); break; case CubeSurface.left: mesh.AddQuad(vertices[0], vertices[3], vertices[7], vertices[4]); break; case CubeSurface.right: mesh.AddQuad(vertices[2], vertices[1], vertices[5], vertices[6]); break; case CubeSurface.front: mesh.AddQuad(vertices[1], vertices[0], vertices[4], vertices[5]); break; case CubeSurface.back: mesh.AddQuad(vertices[3], vertices[2], vertices[6], vertices[7]); break; } mesh.AddQuadUV(uvBasePoint, 16); }
bool CheckAdjacent(int x, int y, int z, CubeSurface surfaceTo) { int minValue = 0; int maxValue = CubeMetrics.CHUNK_WIDTH - 1; switch (surfaceTo) { case CubeSurface.front: if (z + 2 > CubeMetrics.CHUNK_WIDTH) { return(NeighborChunks[(int)AdjacentDirection.front] && CubeData.ToCubeData(NeighborChunks[(int)AdjacentDirection.front]. cubes[CubeMetrics.GetCubeIndexToChunk(x, y, minValue)]).HasCube); } return(CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(x, y, z + 1)]).HasCube); case CubeSurface.back: if (z - 1 < 0) { return(NeighborChunks[(int)AdjacentDirection.back] && CubeData.ToCubeData(NeighborChunks[(int)AdjacentDirection.back]. cubes[CubeMetrics.GetCubeIndexToChunk(x, y, maxValue)]).HasCube); } return(CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(x, y, z - 1)]).HasCube); case CubeSurface.left: if (x - 1 < 0) { return(NeighborChunks[(int)AdjacentDirection.left] && CubeData.ToCubeData(NeighborChunks[(int)AdjacentDirection.left].cubes[CubeMetrics.GetCubeIndexToChunk(maxValue, y, z)]).HasCube); } return(CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(x - 1, y, z)]).HasCube); case CubeSurface.right: if (x + 2 > CubeMetrics.CHUNK_WIDTH) { return(NeighborChunks[(int)AdjacentDirection.right] && CubeData.ToCubeData(NeighborChunks[(int)AdjacentDirection.right].cubes[CubeMetrics.GetCubeIndexToChunk(minValue, y, z)]).HasCube); } return(CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(x + 1, y, z)]).HasCube); case CubeSurface.up: if (y + 2 > CubeMetrics.CHUNK_WIDTH) { return(NeighborChunks[(int)AdjacentDirection.up] && CubeData.ToCubeData(NeighborChunks[(int)AdjacentDirection.up].cubes[CubeMetrics.GetCubeIndexToChunk(x, minValue, z)]).HasCube); } return(CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(x, y + 1, z)]).HasCube); case CubeSurface.down: if (y - 1 < 0) { return(NeighborChunks[(int)AdjacentDirection.down] && CubeData.ToCubeData(NeighborChunks[(int)AdjacentDirection.down].cubes[CubeMetrics.GetCubeIndexToChunk(x, maxValue, z)]).HasCube); } return(CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(x, y - 1, z)]).HasCube); default: return(false); } }
bool CheckAdjacent(int index, CubeSurface surfaceTo) { int tempIndex = index; int y = tempIndex / (localScale * localScale); int z = (tempIndex - (y * localScale * localScale)) / localScale; int x = tempIndex - (y * localScale * localScale) - (z * localScale); switch (surfaceTo) { case CubeSurface.front: if (z + 1 > 6) { return(false); } z += 1; break; case CubeSurface.back: if (z - 1 < 0) { return(false); } z -= 1; break; case CubeSurface.left: if (x - 1 < 0) { return(false); } x -= 1; break; case CubeSurface.right: if (x + 1 > 6) { return(false); } x += 1; break; case CubeSurface.up: if (y + 1 > 6) { return(false); } y += 1; break; case CubeSurface.down: if (y - 1 < 0) { return(false); } y -= 1; break; } int i = x + y * localScale * localScale + z * localScale; CubeData data = CubeData.ToCubeData(datas[i]); return(data.active); }
/// <summary> /// Returns a list of all of the cubies of a cube surface /// </summary> /// <param name="surface">the cube surface</param> /// <returns>List of the cubies of the cube surface</returns> private List<Cubie> getCubeSurface(CubeSurface surface) { List<Cubie> cubies; switch (surface) { case CubeSurface.Front: cubies = this.cubies.Where(q => q.PosX == 1).ToList(); break; case CubeSurface.Back: cubies = this.cubies.Where(q => q.PosX == -1).ToList(); break; case CubeSurface.Left: cubies = this.cubies.Where(q => q.PosY == -1).ToList(); break; case CubeSurface.Right: cubies = this.cubies.Where(q => q.PosY == 1).ToList(); break; case CubeSurface.Top: cubies = this.cubies.Where(q => q.PosZ == 1).ToList(); break; case CubeSurface.Bottom: cubies = this.cubies.Where(q => q.PosZ == -1).ToList(); break; case CubeSurface.MiddleHorizontal: cubies = this.cubies.Where(q => q.PosZ == 0).ToList(); break; case CubeSurface.MiddleVertical: cubies = this.cubies.Where(q => q.PosY == 0).ToList(); break; case CubeSurface.MiddleCircular: cubies = this.cubies.Where(q => q.PosX == 0).ToList(); break; default: cubies = null; break; } return cubies; }
/// <summary> /// Rotates a cube surface to a wished direction /// </summary> /// <param name="cubeSurface">The surface of the cube to rotate</param> /// <param name="direction">The direction (left/right) of the cube</param> public void rotateSurface(CubeSurface cubeSurface, Direction direction, bool isRecorded = true) { // get the cubies of the wished cube surface List<Cubie> cubies = this.getCubeSurface(cubeSurface); int tempPos; CubieColor tempCol; int multX = 1; int multY = 1; int multZ = 1; string surfaceText = cubeSurface.ToString(); string directionText = direction.ToString(); string imgLocation = String.Format("/RubiksGUI;component/Images/{0}{1}.png", surfaceText, directionText); switch (cubeSurface) { case CubeSurface.Front: multY = direction == Direction.Left ? -1 : 1; multZ = direction == Direction.Right ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosY; cubie.PosY = cubie.PosZ * multY; cubie.PosZ = tempPos * multZ; // change cubie colors tempCol = cubie.ColY; cubie.ColY = cubie.ColZ; cubie.ColZ = tempCol; } break; case CubeSurface.Back: multY = direction == Direction.Right ? -1 : 1; multZ = direction == Direction.Left ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosY; cubie.PosY = cubie.PosZ * multY; cubie.PosZ = tempPos * multZ; // change cubie colors tempCol = cubie.ColY; cubie.ColY = cubie.ColZ; cubie.ColZ = tempCol; } break; case CubeSurface.Top: multX = direction == Direction.Left ? -1 : 1; multY = direction == Direction.Right ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosX; cubie.PosX = cubie.PosY * multX; cubie.PosY = tempPos * multY; // change cubie colors tempCol = cubie.ColY; cubie.ColY = cubie.ColX; cubie.ColX = tempCol; } break; case CubeSurface.Bottom: multX = direction == Direction.Right ? -1 : 1; multY = direction == Direction.Left ? -1 : 1; foreach (Cubie cubie in cubies) { tempPos = cubie.PosX; cubie.PosX = cubie.PosY * multX; cubie.PosY = tempPos * multY; // change cubie colors tempCol = cubie.ColY; cubie.ColY = cubie.ColX; cubie.ColX = tempCol; } break; case CubeSurface.Left: multX = direction == Direction.Left ? -1 : 1; multZ = direction == Direction.Right ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosX; cubie.PosX = cubie.PosZ * multX; cubie.PosZ = tempPos * multZ; // change cubie colors tempCol = cubie.ColZ; cubie.ColZ = cubie.ColX; cubie.ColX = tempCol; } break; case CubeSurface.Right: multX = direction == Direction.Right ? -1 : 1; multZ = direction == Direction.Left ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosX; cubie.PosX = cubie.PosZ * multX; cubie.PosZ = tempPos * multZ; // change cubie colors tempCol = cubie.ColZ; cubie.ColZ = cubie.ColX; cubie.ColX = tempCol; } break; case CubeSurface.MiddleHorizontal: multX = direction == Direction.Left ? -1 : 1; multY = direction == Direction.Right ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosX; cubie.PosX = cubie.PosY * multX; cubie.PosY = tempPos * multY; // change cubie colors tempCol = cubie.ColY; cubie.ColY = cubie.ColX; cubie.ColX = tempCol; } break; case CubeSurface.MiddleVertical: multX = direction == Direction.Right ? -1 : 1; multZ = direction == Direction.Left ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosX; cubie.PosX = cubie.PosZ * multX; cubie.PosZ = tempPos * multZ; // change cubie colors tempCol = cubie.ColZ; cubie.ColZ = cubie.ColX; cubie.ColX = tempCol; } break; case CubeSurface.MiddleCircular: multY = direction == Direction.Left ? -1 : 1; multZ = direction == Direction.Right ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosY; cubie.PosY = cubie.PosZ * multY; cubie.PosZ = tempPos * multZ; // change cubie colors tempCol = cubie.ColY; cubie.ColY = cubie.ColZ; cubie.ColZ = tempCol; } break; default: break; } if (isRecorded) { // Step +1 this.numberSteps++; this.History.Add(new HistoryItem(this.Clone(), numberSteps, String.Format("{0} {1}", surfaceText, directionText), imgLocation)); } }
/// <summary> /// Rotates a cube surface to a wished direction /// </summary> /// <param name="cubeSurface">The surface of the cube to rotate</param> /// <param name="direction">The direction (left/right) of the cube</param> public void rotateSurface(CubeSurface cubeSurface, Direction direction, bool isRecorded = true) { // get the cubies of the wished cube surface List <Cubie> cubies = this.getCubeSurface(cubeSurface); int tempPos; CubieColor tempCol; int multX = 1; int multY = 1; int multZ = 1; string surfaceText = cubeSurface.ToString(); string directionText = direction.ToString(); string imgLocation = String.Format("/RubiksGUI;component/Images/{0}{1}.png", surfaceText, directionText); switch (cubeSurface) { case CubeSurface.Front: multY = direction == Direction.Left ? -1 : 1; multZ = direction == Direction.Right ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosY; cubie.PosY = cubie.PosZ * multY; cubie.PosZ = tempPos * multZ; // change cubie colors tempCol = cubie.ColY; cubie.ColY = cubie.ColZ; cubie.ColZ = tempCol; } break; case CubeSurface.Back: multY = direction == Direction.Right ? -1 : 1; multZ = direction == Direction.Left ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosY; cubie.PosY = cubie.PosZ * multY; cubie.PosZ = tempPos * multZ; // change cubie colors tempCol = cubie.ColY; cubie.ColY = cubie.ColZ; cubie.ColZ = tempCol; } break; case CubeSurface.Top: multX = direction == Direction.Left ? -1 : 1; multY = direction == Direction.Right ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosX; cubie.PosX = cubie.PosY * multX; cubie.PosY = tempPos * multY; // change cubie colors tempCol = cubie.ColY; cubie.ColY = cubie.ColX; cubie.ColX = tempCol; } break; case CubeSurface.Bottom: multX = direction == Direction.Right ? -1 : 1; multY = direction == Direction.Left ? -1 : 1; foreach (Cubie cubie in cubies) { tempPos = cubie.PosX; cubie.PosX = cubie.PosY * multX; cubie.PosY = tempPos * multY; // change cubie colors tempCol = cubie.ColY; cubie.ColY = cubie.ColX; cubie.ColX = tempCol; } break; case CubeSurface.Left: multX = direction == Direction.Left ? -1 : 1; multZ = direction == Direction.Right ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosX; cubie.PosX = cubie.PosZ * multX; cubie.PosZ = tempPos * multZ; // change cubie colors tempCol = cubie.ColZ; cubie.ColZ = cubie.ColX; cubie.ColX = tempCol; } break; case CubeSurface.Right: multX = direction == Direction.Right ? -1 : 1; multZ = direction == Direction.Left ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosX; cubie.PosX = cubie.PosZ * multX; cubie.PosZ = tempPos * multZ; // change cubie colors tempCol = cubie.ColZ; cubie.ColZ = cubie.ColX; cubie.ColX = tempCol; } break; case CubeSurface.MiddleHorizontal: multX = direction == Direction.Left ? -1 : 1; multY = direction == Direction.Right ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosX; cubie.PosX = cubie.PosY * multX; cubie.PosY = tempPos * multY; // change cubie colors tempCol = cubie.ColY; cubie.ColY = cubie.ColX; cubie.ColX = tempCol; } break; case CubeSurface.MiddleVertical: multX = direction == Direction.Right ? -1 : 1; multZ = direction == Direction.Left ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosX; cubie.PosX = cubie.PosZ * multX; cubie.PosZ = tempPos * multZ; // change cubie colors tempCol = cubie.ColZ; cubie.ColZ = cubie.ColX; cubie.ColX = tempCol; } break; case CubeSurface.MiddleCircular: multY = direction == Direction.Left ? -1 : 1; multZ = direction == Direction.Right ? -1 : 1; foreach (Cubie cubie in cubies) { // change cubie coordinates tempPos = cubie.PosY; cubie.PosY = cubie.PosZ * multY; cubie.PosZ = tempPos * multZ; // change cubie colors tempCol = cubie.ColY; cubie.ColY = cubie.ColZ; cubie.ColZ = tempCol; } break; default: break; } if (isRecorded) { // Step +1 this.numberSteps++; this.History.Add(new HistoryItem(this.Clone(), numberSteps, String.Format("{0} {1}", surfaceText, directionText), imgLocation)); } }
// //bool CheckAdjacent2(int x, int y, int z, CubeSurface surfaceTo) //{ // int minValue = 0; // int maxValue = CubeMetrics.CHUNK_WIDTH - 1; // CubeCoordinate c; // switch (surfaceTo) // { // case CubeSurface.front: // if (z + 2 > CubeMetrics.CHUNK_WIDTH) // { // c = ChunkCoordinate.GetAdjacentCoordinate(AdjacentDirection.front); // //return grid.chunkDatas.ContainsKey(c.ToString()) && // // CubeData.ToCubeData(grid.chunkDatas[c.ToString()][CubeMetrics.GetCubeIndexToChunk(x, y, minValue)]).HasCube; // //Debug.Log(grid.chunkDatas.ContainsKey(c.ToString())); // return NeighborChunks[(int)AdjacentDirection.front] && // CubeData.ToCubeData(NeighborChunks[(int)AdjacentDirection.front]. // cubes[CubeMetrics.GetCubeIndexToChunk(x, y, minValue)]).HasCube; // } // return CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(x, y, z + 1)]).HasCube; // case CubeSurface.back: // if (z - 1 < 0) // { // return NeighborChunks[(int)AdjacentDirection.back] && // CubeData.ToCubeData(NeighborChunks[(int)AdjacentDirection.back]. // cubes[CubeMetrics.GetCubeIndexToChunk(x, y, maxValue)]).HasCube; // } // return CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(x, y, z - 1)]).HasCube; // case CubeSurface.left: // if (x - 1 < 0) // { // return NeighborChunks[(int)AdjacentDirection.left] && // CubeData.ToCubeData(NeighborChunks[(int)AdjacentDirection.left].cubes[CubeMetrics.GetCubeIndexToChunk(maxValue, y, z)]).HasCube; // } // return CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(x - 1, y, z)]).HasCube; // case CubeSurface.right: // if (x + 2 > CubeMetrics.CHUNK_WIDTH) // { // return NeighborChunks[(int)AdjacentDirection.right] && // CubeData.ToCubeData(NeighborChunks[(int)AdjacentDirection.right].cubes[CubeMetrics.GetCubeIndexToChunk(minValue, y, z)]).HasCube; // } // return CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(x + 1, y, z)]).HasCube; // case CubeSurface.up: // if (y + 2 > CubeMetrics.CHUNK_WIDTH) // { // return NeighborChunks[(int)AdjacentDirection.up] && // CubeData.ToCubeData(NeighborChunks[(int)AdjacentDirection.up].cubes[CubeMetrics.GetCubeIndexToChunk(x, minValue, z)]).HasCube; // } // return CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(x, y + 1, z)]).HasCube; // case CubeSurface.down: // if (y - 1 < 0) // { // return NeighborChunks[(int)AdjacentDirection.down] && // CubeData.ToCubeData(NeighborChunks[(int)AdjacentDirection.down].cubes[CubeMetrics.GetCubeIndexToChunk(x, maxValue, z)]).HasCube; // } // return CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(x, y - 1, z)]).HasCube; // default: // return false; // } //} //考虑未实例化到场景中的chunk, 直接在数据表里核对是否需要隐藏 bool CheckAdjacent(int x, int y, int z, CubeSurface surfaceTo, bool isTransparent) { int tempX = x; int tempY = y; int tempZ = z; bool outOfRange = false; CubeCoordinate coordinate; switch (surfaceTo) { case CubeSurface.front: outOfRange = z + 2 > CubeMetrics.CHUNK_WIDTH; coordinate = ChunkCoordinate.GetAdjacentCoordinate(AdjacentDirection.front); tempZ = outOfRange ? 0 : z + 1; break; case CubeSurface.back: outOfRange = z - 1 < 0; coordinate = ChunkCoordinate.GetAdjacentCoordinate(AdjacentDirection.back); tempZ = outOfRange ? CubeMetrics.CHUNK_WIDTH - 1 : z - 1; break; case CubeSurface.left: outOfRange = x - 1 < 0; coordinate = ChunkCoordinate.GetAdjacentCoordinate(AdjacentDirection.left); tempX = outOfRange ? CubeMetrics.CHUNK_WIDTH - 1 : x - 1; break; case CubeSurface.right: outOfRange = x + 2 > CubeMetrics.CHUNK_WIDTH; coordinate = ChunkCoordinate.GetAdjacentCoordinate(AdjacentDirection.right); tempX = outOfRange ? 0 : x + 1; break; case CubeSurface.up: outOfRange = y + 2 > CubeMetrics.CHUNK_WIDTH; coordinate = ChunkCoordinate.GetAdjacentCoordinate(AdjacentDirection.up); tempY = outOfRange ? 0 : y + 1; break; case CubeSurface.down: outOfRange = y - 1 < 0; coordinate = ChunkCoordinate.GetAdjacentCoordinate(AdjacentDirection.down); tempY = outOfRange ? CubeMetrics.CHUNK_WIDTH - 1 : y - 1; break; default: coordinate = ChunkCoordinate; break; } try { return(outOfRange ? grid.chunkDatas.ContainsKey(coordinate.ToString()) && CubeData.ToCubeData(grid.chunkDatas[coordinate.ToString()][CubeMetrics.GetCubeIndexToChunk(tempX, tempY, tempZ)]).HasCube(isTransparent) : CubeData.ToCubeData(cubes[CubeMetrics.GetCubeIndexToChunk(tempX, tempY, tempZ)]).HasCube(isTransparent)); } catch { Debug.Log("chunk" + ChunkCoordinate.ToString() + ":Surface" + surfaceTo + "index is error"); return(false); } }