private int DrawFromVertex2(IntVector2 topLeftCell, HexSprite currentSprite, IntVector2 currentCell, List <IntVector2> gridCells, List <Vector3> vertexList) { IntVector2 nextCell; // compare the coordinates of the next // if current x even, the next cell on the same y level is up; if odd, it's down // if even and x, y or if odd and x, y-1 if (currentCell.x % 2 == 0) { nextCell = gridCells.FirstOrDefault(c => c.x == currentCell.x + 1 && c.y == currentCell.y); } else { nextCell = gridCells.FirstOrDefault(c => c.x == currentCell.x + 1 && c.y == currentCell.y - 1); } if (nextCell != null) { // we need 6->1 of the next cell HexSprite nextSprite = _cells[nextCell.x, nextCell.y].GetComponent <HexSprite>(); vertexList.Add(nextSprite.FindVertex1()); return(DrawFromVertex1(topLeftCell, nextSprite, nextCell, gridCells, vertexList)); } else { // vertex 2 should not touch the topLeftHex, so draw 2 -> 3 on this cell and continue vertexList.Add(currentSprite.FindVertex3()); return(DrawFromVertex3(topLeftCell, currentSprite, currentCell, gridCells, vertexList)); } }
private int DrawFromVertex4(IntVector2 topLeftCell, HexSprite currentSprite, IntVector2 currentCell, List <IntVector2> gridCells, List <Vector3> vertexList) { // see if there is a node directly below us IntVector2 nextCell = gridCells.FirstOrDefault(c => c.x == currentCell.x && c.y == currentCell.y + 1); if (nextCell != null) { // we need 2->3 of the next cell HexSprite nextSprite = _cells[nextCell.x, nextCell.y].GetComponent <HexSprite>(); vertexList.Add(nextSprite.FindVertex3()); return(DrawFromVertex3(topLeftCell, nextSprite, nextCell, gridCells, vertexList)); } else { //top left cannot be directly below us // draw 4->5 and continue vertexList.Add(currentSprite.FindVertex5()); return(DrawFromVertex5(topLeftCell, currentSprite, currentCell, gridCells, vertexList)); } }