Esempio n. 1
0
        public GameObject AddNode(MBGraphNode from = null, float edgeWeight = default, EdgeDirectionality directionality = default)
        {
            GameObject obj = new GameObject("Node", typeof(MBGraphNode));

            obj.transform.parent   = transform;
            obj.transform.position = from != null ? from.transform.position : transform.position;

            MBGraphNode graphNodeComponent = obj.GetComponent <MBGraphNode>();

            graphNodeComponent.mbGraph = this;

            if (from == null)
            {
                graphNodeComponent.nodeId = graph.AddNode(obj).Id;
            }
            else
            {
                graphNodeComponent.nodeId = graph.AddNode(obj, from.nodeId, edgeWeight, directionality).Id;
            }

            return(obj);
        }
Esempio n. 2
0
 public void DestroyNode(MBGraphNode node)
 {
     Destroy(node);
 }
Esempio n. 3
0
 public void RemoveEdge(MBGraphNode from, MBGraphNode to, float edgeWeight = default, EdgeDirectionality directionality = default)
 {
     RemoveEdge(from.nodeId, to.nodeId);
 }
Esempio n. 4
0
 public void SetEdge(MBGraphNode from, MBGraphNode to, float edgeWeight = default, EdgeDirectionality directionality = default)
 {
     SetEdge(from.nodeId, to.nodeId, edgeWeight, directionality);
 }