private void RemoveNode(SearchTrackNode node)
        {
            int nodeIndex = _nodesToSearch.IndexOf(node);

            if (nodeIndex < _nodesToSearchIndex)
            {
                _nodesToSearchIndex--;
            }

            _nodesToSearch.Remove(node);
        }
        private void OnNodeSearched(GuardStateBrainPBT guard, SearchTrackNode node)
        {
            _nodesToSearch.Remove(node);
            // use the list stored in the actual search track since we pop things from our local copy
            if (!_searchTrack.GetSearchTrackNodes().Contains(node))
            {
                return;
            }

            if (_nodesToSearch.Count != 0)
            {
                // guard.SearchPoint = _nodesToSearch.Pop();
                guard.SearchPoint = GetNextSearchPoint();
            }
            else
            {
                guard.SearchPoint = null;
                RegisterComplete();
            }
        }
    void ConfigureChildren()
    {
        SearchTrackNode[] searchTrackNodes = gameObject.GetComponentsInChildren <SearchTrackNode> ();

        _bridgeExitsNegative = new List <SearchTrackNode> ();
        _bridgeExitsPositive = new List <SearchTrackNode> ();

        //_exits = new List<SearchTrackNode> ();

        for (int i = 0; i < searchTrackNodes.Length; i++)
        {
            SearchTrackNode searchTrackNode = searchTrackNodes [i];

            switch (searchTrackNode.nodeType)
            {
            case (SearchTrackNode.NodeType.Exit):
            case (SearchTrackNode.NodeType.DisregardableExit):
                //_exits.Add (searchTrackNode);
                break;

            case (SearchTrackNode.NodeType.BridgeExitLeft):
                _bridgeExitsNegative.Add(searchTrackNode);
                break;

            case (SearchTrackNode.NodeType.BridgeExitRight):
                _bridgeExitsPositive.Add(searchTrackNode);
                break;

            default:
                this._searchTrackNodes.Add(searchTrackNode);
                break;
            }

            searchTrackNode.Track = this;
        }
    }