void UpdateEdges() { foreach (var eo in _grid.EdgeObject()) { if (eo.GetComponent <WallEdgeObject>()) { if (eo.Edge.GetConnectedTriangles().Count == 2) { var t0 = eo.Edge.GetConnectedTriangles()[0]; var t1 = eo.Edge.GetConnectedTriangles()[1]; var p = 0.5f * (GetCurrentCircumCenter(_grid.GetGrid().GetTriangles().ToArray()[t1]) + GetCurrentCircumCenter(_grid.GetGrid().GetTriangles().ToArray()[t0])); var d = GetCurrentCircumCenter(_grid.GetGrid().GetTriangles().ToArray()[t1]) - GetCurrentCircumCenter(_grid.GetGrid().GetTriangles().ToArray()[t0]); var r = Quaternion.LookRotation(d.normalized); eo.UpdatePosition(p); eo.UpdateRotation(r); var scale = eo.transform.localScale; scale.z = d.magnitude; eo.transform.localScale = scale; } } if (eo.GetComponent <FloorEdgeObject>()) { } } }
void InitializeGrid() { _savedPositions = new System.Collections.Generic.List <Vector3>(); _currentPositions = new System.Collections.Generic.List <Vector3>(); _grid = new GridObject(); _grid.Initialize(Grid.Factory.CreateTriangleGrid3D(_countX, _countY, _countZ)); _savedPositions.AddRange(SetVertexPosition()); _currentPositions.AddRange(_savedPositions); _grid.VertexObject().AddRange(CreateVertexObject()); _grid.EdgeObject().AddRange(CreateHexagonEdgeObject()); }
void Start() { _grid = GetComponent <GridManager>().GetGridObject(); _vertexObjects = _grid.VertexObject(); _edgeObjects = _grid.EdgeObject(); }