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 objA = list[i]; bool flag = false; for (int j = 0; j < selector.Count; j++) { if (object.ReferenceEquals(objA, selector[j])) { flag = true; break; } } if (!flag) { return(true); } } return(false); }
private void SetupNodeBlocker() { if (this.blocker != null) { return; } this.blocker = GetComponent <SingleNodeBlocker>(); this.blocker.manager = Pathfinder.Instance.BlockManager; }
protected virtual void Awake() { isNotAffectedByCondition = true; blockManager = GameObject.Find("AStarManager").GetComponent <BlockManager>(); blocker = GetComponent <SingleNodeBlocker>(); traversalProvider = new BlockManager.TraversalProvider(blockManager, BlockManager.BlockMode.AllExceptSelector, new List <SingleNodeBlocker>() { blocker }); }
/** Register \a 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. */ 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); })); }
private void Start() { GameController.instance.AddEnemyToList(this); blocker = GetComponent <SingleNodeBlocker>(); blocker.BlockAtCurrentPosition(); movingToPoint.parent = null; CalculateObstacles(); }
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)); }
/** Remove \a 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. */ 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(blockersInNode); } } })); }
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(list); } } }, null)); }
public bool NodeContainsAnyOf(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]; for (int j = 0; j < selector.Count; j++) { if (singleNodeBlocker == selector[j]) { return(true); } } } return(false); }
void Start() { blocker = GetComponent <SingleNodeBlocker>(); blocker.BlockAtCurrentPosition(); }
private void Start() { blocker = GetComponent <SingleNodeBlocker>(); blocker.manager = FindObjectOfType <BlockManager>(); UpdateBlocker(); }
void Awake() { animator = GetComponent <Animator>(); blocker = GetComponent <SingleNodeBlocker>(); }