using System; using System.Collections.Generic; using AI; using DefaultNamespace; using DefaultNamespace.AI; using Units; using UnityEngine; using Random = UnityEngine.Random; namespace HexFiled { public static class HexManager { public static Dictionary UnitCurrentCell; public static Dictionary> CellByColor; public static Dictionary agents; public static void GetNearestDifferCell(UnitColor color, Queue path) { HexCell end = UnitCurrentCell[color].cell; var itters = 0; while (end.Color == color) { var tmp = end; do { end = tmp.Neighbors[Random.Range(0, 6)]; itters++; } while (end == null && itters < 5); if (itters >= 5) { return; } path.Enqueue(end); } } public static void PaintHexList(List field, UnitColor color) { List> actions = new List>(); field.ForEach(x => actions.Add(x.PaintHex)); TimerHelper.Instance.StartTimer(actions, 0.05f, color); } } }