Esempio n. 1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="from"></param>
    /// <param name="to"></param>
    /// <returns></returns>
    public Edge_Behaviour CreateEdgeBehaviour(Node_Behaviour from, Node_Behaviour to)
    {
        //Debug.Log("GraphBehaviour: Going to create EdgeBehaviour for From-Node " + from.node.Id + " and To-Node " + to.node.Id);
        if (from == null || to == null)
        {
            return(null);
        }

        Edge edge = this.graph.CreateEdge(from.Node, to.Node);

        if (edgesParent == null)
        {
            CheckParents();
        }

        //Debug.Log("GraphBehaviour: Create EdgeBehaviour for From-Node " + from.node.Id + " and To-Node " + to.node.Id);
        GameObject     edgeGO        = edgesParent.CreateChild(edge.Id);
        Edge_Behaviour edgeBehaviour = edgeGO.AddComponent <Edge_Behaviour>();

        edgeBehaviour.InitializeBehaviour(this, edge, from, to);

        AddEdgeBehaviour(edgeBehaviour);

        return(edgeBehaviour);
    }
Esempio n. 2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="edge"></param>
    /// <returns></returns>
    private Edge_Behaviour CreateEdgeBehaviour(Edge edge)
    {
        GameObject     edgeGO        = edgesParent.CreateChild(edge.Id);
        Edge_Behaviour edgeBehaviour = edgeGO.AddComponent <Edge_Behaviour>();

        edgeBehaviour.InitializeBehaviour(this, edge, GetNodeBehaviourByID(edge.From.Id), GetNodeBehaviourByID(edge.To.Id));

        AddEdgeBehaviour(edgeBehaviour);
        return(edgeBehaviour);
    }