private void FindPath(MapTile dest, PathRun units) { if (dest != null && !dest.blocked && units.currentTile != null && !units.currentTile.blocked && dest != units.currentTile) { RoadResult ret = IggPathFinder.FindPaths(units.currentTile, dest); units.SetRoad(ret); if (m_ListPersion.Contains(units) == false) { m_ListPersion.Add(units); } } }
private void AddUnit(MapTile t) { if (t != null && m_UnitKey < 10) { List <PathRun> list = new List <PathRun>(); foreach (MapTile tile in TileHelp.GetAllNeighbours(t)) { GameObject g = GameObject.Instantiate(unitGo); g.transform.parent = tnode; Vector3 v = PathFind.instance.m_map.GetMapTileWorldPos(tile); g.transform.position = v; PathRun s = g.GetComponent <PathRun>(); s.group = m_UnitKey; s.currentTile = tile; list.Add(s); } m_DicUnits.Add(m_UnitKey++, list); } }