public Edge(Node a, Node b, connectDir dir, float cost) { A = a; B = b; Direction = dir; Cost = cost; }
//--------------------------------------------------------------------------------------------------------------- public EditorConnection(EditorNode a, EditorNode b, connectDir dir=connectDir.both, bool force=false) { this.nodeA = a; this.nodeB = b; this.dir = dir; this.forceConnection = force; }
EditorConnection CreateConnection(EditorNode a, EditorNode b, connectDir dir, bool forced) { if(a != b && a != null && b != null) { if(areConnected(a, b)) { EditorConnection c = edges.Find(x=> x.containsNodes(a, b)); if(!c.forceConnection) { c.supressConnection = c.magnitude <= data.autoConnectionDist; } else c.supressConnection = !c.supressConnection; c.forceConnection = true; isDirty = true; return c; } else { EditorConnection c = new EditorConnection(a, b, dir, forced); c.supressConnection = false; edges.Add(c); isDirty = true; return c; } } return null; }
public Edge(Node a, Node b, connectDir dir) { A = a; B = b; Cost = 0; }
/// <summary> /// cycle through connection mode /// </summary> public void NextMode() { dir = (connectDir) ((((int)dir) + 1) % System.Enum.GetNames(typeof(connectDir)).Length); forceConnection = true; }