Graph.getResponses C# (CSharp) Method

getResponses() public method

public getResponses ( int p_id ) : ArrayList
p_id int
return ArrayList
    public ArrayList getResponses(int p_id)
    {
        if(debug)
            Debug.Log("Getting Responses for Node: "+p_id);

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

Usage Example

    //Returns the list of responses that the player can say to the NPC
    public override ArrayList GetResponses()
    {
        if (currentNode == null)
        {
            return(null);
        }

        return(g.getResponses(currentNode.getId()));
    }