Пример #1
0
    //if the current sector empty, looking for closest table cells matching neighbour sectors
    private TableCell FindClosestCell(Point3 sector)
    {
        Neighbours nb = new Neighbours();

        nb.CreateDistanceMap(sector);

        float[] keys = nb.keys;

        for (int i = 0; i < nb.length; i++)
        {
            float key = nb.keys[i];

            TableCell cell = logBatch.table.Find(o => o.key.Equals(nb.GetNeighbour(key)));

            if (cell != null)
            {
                return(cell);
            }
        }

        agentIsOnline = false;

        throw new Exception("All neighbours are empty!");
    }