Graph.getReentryNode C# (CSharp) Method

getReentryNode() public method

public getReentryNode ( int p_id ) : Node
p_id int
return Node
    public Node getReentryNode(int p_id)
    {
        if(debug)
            Debug.Log("Getting Exit Response for Node: "+p_id);

        foreach (KeyValuePair<Node, ArrayList> pair in graph)
        {
            if(pair.Key.getId() == p_id)
            {
                foreach (Response response in pair.Value)
                {
                    if(response.isExit())
                        return this.getNode(response.getNextNode());
                }
            }
        }
        return null;
    }

Usage Example

 // Sets up the conversation so that when the player returns, the
 // conversation continues properly
 public override void endConversation()
 {
     currentNode = g.getReentryNode(currentNode.getId());
 }