public void initializeGrowther() { GraphManager = transform.GetComponent <HexigonGraphManager>(); GraphDone = GraphManager.GraphReady(); displayed = false; HexigonGrid = GraphManager._hexGrid(); _graph = HexigonGrid.edgeGraph; Depth = new int[_graph.VertexCount]; TenVertex = HexigonGrid.TensileVertexObjects; TenEdge = HexigonGrid.TensileEdgeObjects; _queue = new Queue <int>(); _sourceQueue = new Queue <int>(); countX = GraphManager.GetCountX(); countY = GraphManager.GetCountY(); countZ = GraphManager.GetCountZ(); }
private Dictionary <Tags, DownwardEdges> GenerateEdges(List <TagOrdering> orderings) { var result = new EdgeGraph(); lock (Tags.Registry) foreach (var ordering in orderings) { result.Connect(ordering.Higher, ordering.Lower); foreach (var kvp in Tags.Registry) { GenerateEdge(result, kvp.Value, ordering); } foreach (var kvp in TagSet.Registry) { GenerateEdge(result, kvp.Value, ordering); } } return(result.Finalize()); }
/// <summary> /// /// </summary> private void Awake() { _graph = EdgeGraph.Factory.CreateTriangleGrid(_countX, _countY); // initialize game objects InitVertexObjects(); InitEdgeObjects(); // initialize additonal attributes _vertexDistances = new float[_graph.VertexCount]; _edgeLengths = new float[_graph.EdgeCount]; _edgeTraffic = new int[_graph.EdgeCount]; // initialize edge lengths for (int i = 0; i < _graph.EdgeCount; i++) { var e = _graph.GetEdge(i); var p0 = _vertices[e.Start].transform.localPosition; var p1 = _vertices[e.End].transform.localPosition; _edgeLengths[i] = Vector3.Distance(p0, p1) + UnityEngine.Random.Range(0, 0.001f); } }
void GetClosestEdge() { if (Input.GetMouseButtonDown(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { point = hit.point; if (hit.transform.GetComponent <EdgeFinder>() != null) { edgeGraph = GetComponent <EdgeFinder>().getEdgeGraph; } } } if (edgeGraph == null) { return; } }
/// <summary> /// /// </summary> public void Initialize(EdgeGraph graph) { _graph = graph; _vertexObjs = new List <V>(_graph.VertexCount); _edgeObjs = new List <E>(_graph.EdgeCount); }