コード例 #1
0
ファイル: Node_Editor.cs プロジェクト: Janacek/NodeEditor
    /// <summary>
    /// Creates and opens a new empty node canvas
    /// </summary>
    public void NewNodeCanvas()
    {
        nodeCanvas       = ScriptableObject.CreateInstance <Node_Canvas_Object>();
        nodeCanvas.nodes = new List <Node>();
        openedCanvas     = "New Canvas";
        openedCanvasPath = "";

        RootNode rootNode = RootNode.Create(new Rect(0, 0, 100, 50));
        EndNode  endNode  = EndNode.Create(new Rect(0, 200, 100, 50));

        rootNode.Linkers[(int)Node.LinkType.To].connection    = endNode.Linkers[(int)Node.LinkType.From];
        rootNode.Linkers[(int)Node.LinkType.To].connectionID  = endNode.ID;
        endNode.Linkers[(int)Node.LinkType.From].connection   = rootNode.Linkers[(int)Node.LinkType.To];
        endNode.Linkers[(int)Node.LinkType.From].connectionID = rootNode.ID;
    }