/* * Take into account which direction each path * is going to. * */ public void CreateLine(Tile currentTile, Tile nextTile) { if (nextTile == null) { return; } Point difference = new Point((nextTile.X - currentTile.X), (nextTile.Y - currentTile.Y)); HexTile currentHexTile = currentTile.hexTile; HexTile nextHexTile = nextTile.hexTile; if (currentTile.Y % 2 == 0) { if (difference.X == -1 && difference.Y == 1) { //TOP LEFT currentHexTile.ActivatePath(PATH_DIRECTION.TOP_LEFT); nextHexTile.ActivatePath(PATH_DIRECTION.BOTTOM_RIGHT); } else if (difference.X == 0 && difference.Y == 1) { //TOP RIGHT currentHexTile.ActivatePath(PATH_DIRECTION.TOP_RIGHT); nextHexTile.ActivatePath(PATH_DIRECTION.BOTTOM_LEFT); } else if (difference.X == 1 && difference.Y == 0) { //RIGHT currentHexTile.ActivatePath(PATH_DIRECTION.RIGHT); nextHexTile.ActivatePath(PATH_DIRECTION.LEFT); } else if (difference.X == 0 && difference.Y == -1) { //BOTTOM RIGHT currentHexTile.ActivatePath(PATH_DIRECTION.BOTTOM_RIGHT); nextHexTile.ActivatePath(PATH_DIRECTION.TOP_LEFT); } else if (difference.X == -1 && difference.Y == -1) { //BOTTOM LEFT currentHexTile.ActivatePath(PATH_DIRECTION.BOTTOM_LEFT); nextHexTile.ActivatePath(PATH_DIRECTION.TOP_RIGHT); } else if (difference.X == -1 && difference.Y == 0) { //LEFT currentHexTile.ActivatePath(PATH_DIRECTION.LEFT); nextHexTile.ActivatePath(PATH_DIRECTION.RIGHT); } } else { if (difference.X == 0 && difference.Y == 1) { //TOP LEFT currentHexTile.ActivatePath(PATH_DIRECTION.TOP_LEFT); nextHexTile.ActivatePath(PATH_DIRECTION.BOTTOM_RIGHT); } else if (difference.X == 1 && difference.Y == 1) { //TOP RIGHT currentHexTile.ActivatePath(PATH_DIRECTION.TOP_RIGHT); nextHexTile.ActivatePath(PATH_DIRECTION.BOTTOM_LEFT); } else if (difference.X == 1 && difference.Y == 0) { //RIGHT currentHexTile.ActivatePath(PATH_DIRECTION.RIGHT); nextHexTile.ActivatePath(PATH_DIRECTION.LEFT); } else if (difference.X == 1 && difference.Y == -1) { //BOTTOM RIGHT currentHexTile.ActivatePath(PATH_DIRECTION.BOTTOM_RIGHT); nextHexTile.ActivatePath(PATH_DIRECTION.TOP_LEFT); } else if (difference.X == 0 && difference.Y == -1) { //BOTTOM LEFT currentHexTile.ActivatePath(PATH_DIRECTION.BOTTOM_LEFT); nextHexTile.ActivatePath(PATH_DIRECTION.TOP_RIGHT); } else if (difference.X == -1 && difference.Y == 0) { //LEFT currentHexTile.ActivatePath(PATH_DIRECTION.LEFT); nextHexTile.ActivatePath(PATH_DIRECTION.RIGHT); } } // currentHexTile.path.SetActive(true); // var line = (GameObject)Instantiate(Line); // line.transform.position = GetWorldCoordinates(tile.Location.X, tile.Location.Y, 1f); // _path.Add(line); }