// Token: 0x06002777 RID: 10103 RVA: 0x001B1BE4 File Offset: 0x001AFDE4
        public bool NodeContainsAnyExcept(GraphNode node, List <SingleNodeBlocker> selector)
        {
            List <SingleNodeBlocker> list;

            if (!this.blocked.TryGetValue(node, out list))
            {
                return(false);
            }
            for (int i = 0; i < list.Count; i++)
            {
                SingleNodeBlocker singleNodeBlocker = list[i];
                bool flag = false;
                for (int j = 0; j < selector.Count; j++)
                {
                    if (singleNodeBlocker == selector[j])
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#2
0
        /// <summary>
        /// Register blocker as being present at the specified node.
        /// Calling this method multiple times will add multiple instances of the blocker to the node.
        ///
        /// Note: The node will not be blocked immediately. Instead the pathfinding
        /// threads will be paused and then the update will be applied. It is however
        /// guaranteed to be applied before the next path request is started.
        /// </summary>
        public void InternalBlock(GraphNode node, SingleNodeBlocker blocker)
        {
            AstarPath.active.AddWorkItem(new AstarWorkItem(() => {
                List <SingleNodeBlocker> blockersInNode;
                if (!blocked.TryGetValue(node, out blockersInNode))
                {
                    blockersInNode = blocked[node] = ListPool <SingleNodeBlocker> .Claim();
                }

                blockersInNode.Add(blocker);
            }));
        }
 // Token: 0x06002778 RID: 10104 RVA: 0x001B1C48 File Offset: 0x001AFE48
 public void InternalBlock(GraphNode node, SingleNodeBlocker blocker)
 {
     AstarPath.active.AddWorkItem(new AstarWorkItem(delegate()
     {
         List <SingleNodeBlocker> list;
         if (!this.blocked.TryGetValue(node, out list))
         {
             list = (this.blocked[node] = ListPool <SingleNodeBlocker> .Claim());
         }
         list.Add(blocker);
     }, null));
 }
示例#4
0
        /// <summary>
        /// Remove blocker from the specified node.
        /// Will only remove a single instance, calling this method multiple
        /// times will remove multiple instances of the blocker from the node.
        ///
        /// Note: The node will not be unblocked immediately. Instead the pathfinding
        /// threads will be paused and then the update will be applied. It is however
        /// guaranteed to be applied before the next path request is started.
        /// </summary>
        public void InternalUnblock(GraphNode node, SingleNodeBlocker blocker)
        {
            AstarPath.active.AddWorkItem(new AstarWorkItem(() => {
                List <SingleNodeBlocker> blockersInNode;
                if (blocked.TryGetValue(node, out blockersInNode))
                {
                    blockersInNode.Remove(blocker);

                    if (blockersInNode.Count == 0)
                    {
                        blocked.Remove(node);
                        ListPool <SingleNodeBlocker> .Release(ref blockersInNode);
                    }
                }
            }));
        }
 // Token: 0x06002779 RID: 10105 RVA: 0x001B1C8C File Offset: 0x001AFE8C
 public void InternalUnblock(GraphNode node, SingleNodeBlocker blocker)
 {
     AstarPath.active.AddWorkItem(new AstarWorkItem(delegate()
     {
         List <SingleNodeBlocker> list;
         if (this.blocked.TryGetValue(node, out list))
         {
             list.Remove(blocker);
             if (list.Count == 0)
             {
                 this.blocked.Remove(node);
                 ListPool <SingleNodeBlocker> .Release(ref list);
             }
         }
     }, null));
 }