RegisterSafeUpdate() public static méthode

public static RegisterSafeUpdate ( OnVoidDelegate callback, bool threadSafe ) : void
callback OnVoidDelegate
threadSafe bool
Résultat void
 public void removeSmallRegions()
 {
     AstarPath.RegisterSafeUpdate(delegate
     {
         int[] sizes             = new int[10000];
         RecastGraph recastGraph = AstarPath.active.astarData.recastGraph;
         recastGraph.GetNodes(delegate(GraphNode node)
         {
             sizes[(int)((UIntPtr)node.Area)]++;
             return(true);
         });
         int largest = 0;
         for (int i = 0; i < sizes.Length; i++)
         {
             largest = ((sizes[i] <= sizes[largest]) ? largest : i);
         }
         recastGraph.GetNodes(delegate(GraphNode node)
         {
             bool flag = false;
             using (List <uint> .Enumerator enumerator = Scene.MutantControler.mostCommonArea.GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     int num = (int)enumerator.Current;
                     if ((long)num == (long)((ulong)node.Area))
                     {
                         flag = true;
                     }
                 }
             }
             if ((ulong)node.Area != (ulong)((long)largest) && !flag)
             {
                 node.Walkable = false;
             }
             return(true);
         });
         AstarPath.active.FloodFill();
     });
 }
Exemple #2
0
 public static void RegisterSafeUpdate(Action callback, bool threadSafe)
 {
     AstarPath.RegisterSafeUpdate(callback);
 }