Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. /** True if the node contains any blocker which is not included in the \a selector list */
  2.     public bool NodeContainsAnyExcept (GraphNode node, List<SingleNodeBlocker> selector) {
  3.         List<SingleNodeBlocker> blockersInNode;
  4.         if (!blocked.TryGetValue(node, out blockersInNode)) {
  5.             return false;
  6.         }
  7.  
  8.         for (int i = 0; i < blockersInNode.Count; i++) {
  9.             var inNode = blockersInNode[i];
  10.             bool found = false;
  11.             for (int j = 0; j < selector.Count; j++) {
  12.                 // Need to use ReferenceEquals because this code may be called from a separate thread
  13.                 // and the equality comparison that Unity provides is not thread safe
  14.                 if (System.Object.ReferenceEquals(inNode, selector[j])) {
  15.                     found = true;
  16.                     break;
  17.                 }
  18.             }
  19.             if (!found) return true;
  20.         }
  21.         return false;
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement