private List <Vector3Int> updateQueue(List <Vector3Int> queue, char mode, bool include) { List <Vector3Int> queue2 = new List <Vector3Int>(); while (queue.Count > 0) { Vector3Int check = queue[0]; int x = check.x, y = check.y, z = check.z; queue.Remove(check); int row = Mathf.Abs(check.y % 2); Vector3Int left = new Vector3Int(x - 1, y, z); Vector3Int right = new Vector3Int(x + 1, y, z); Vector3Int upLeft = new Vector3Int(x - 1 + row, y + 1, z); Vector3Int upRight = new Vector3Int(x + row, y + 1, z); Vector3Int downLeft = new Vector3Int(x - 1 + row, y - 1, z); Vector3Int downRight = new Vector3Int(x + row, y - 1, z); foreach (Vector3Int dir in new Vector3Int[] { left, right, upLeft, upRight, downLeft, downRight }) { TMapController.tileStruct tileHas = TMapController.M.TileHas(dir); if (!((tileHas.land && !tileHas.obstacle) || flying == true || mode == 'A')) { continue; } if (mode == 'M' && flying == false && tileHas.army != null && tileHas.army != army) { continue; } if (tileHas.land && !tileHas.obstacle && !withinRange.Contains(dir) && !excludeRange.Contains(dir)) { if (!((mode == 'M') && (tileHas.army != null || tileHas.dead) || (tileHas.army == army || tileHas.dead))) { if (include) { withinRange.Add(dir); } else { excludeRange.Add(dir); } } } queue2.Add(dir); } } queue = queue2; return(queue); }
void HighlightMap(int xMin, int xMax) { allowed = new List <Vector3Int>(); for (int y = -5; y < 6; y++) { for (int x = xMin; x < xMax; x++) { Vector3Int v = new Vector3Int(x, y, 0); TMapController.tileStruct tileHas = TMapController.M.TileHas(v); if (tileHas.land && !tileHas.obstacle) { TMapController.M.SetHighlight(v, 'M'); allowed.Add(v); } } } }