private Junction newJunction(Edge edgeA, Edge edgeB, Node node, int index) { Junction junction = new Junction (screen: Screen, grid: this, from: edgeA, to: edgeB, node: node, index: index); junction.IsVisible = true; junction.World = World; return junction; }
private void BuildIndex() { fromMap.Clear (); toMap.Clear (); IndexRebuilt = () => {}; junctionMap.Clear (); Node zero = new Node (0, 0, 0); for (int i = 0; i < (int)Math.Floor (_edges.Length / 2f); ++i) { Edge edge1 = _edges [i * 2 + 0]; Edge edge2 = _edges [i * 2 + 1]; fromMap [edge1] = zero - edge1.Direction; toMap [edge1] = zero; fromMap [edge2] = zero; toMap [edge2] = zero + edge2.Direction; Node node = NodeAfterEdge (edge1); Junction junction = new Junction (screen: Screen, grid: this, from: edge1, to: edge2, node: node, index: i * 2); junctionMap.Add (node, junction); } IndexRebuilt (); }