private void DrawRoads(TownGeometry geometry, StringBuilder sb) { Roads = new GameObject("Roads"); Roads.layer = LayerMask.NameToLayer("Map"); Roads.transform.parent = child; Roads.transform.localPosition = Vector3.zero; Cube cube; foreach (var road in geometry.Roads) { Geom.Vector2 last = new Geom.Vector2(0, 0); foreach (var current in road) { if (last.x != 0 && last.y != 0) { float MovedlastX = ScaleToWorldWithOffset(last.x, town.townOffset.x); float MovedlastY = ScaleToWorldWithOffset(last.y, town.townOffset.y); float MovedcurrentX = ScaleToWorldWithOffset(current.x, town.townOffset.x); float MovedcurrentY = ScaleToWorldWithOffset(current.y, town.townOffset.y); cube = new Cube("Road", GetLineVertices( MovedlastX, MovedcurrentX, MovedlastY, MovedcurrentY, 3 ), .2f, rendererOptions.RoadMaterial, Roads.transform, false, true); cube.Transform.localPosition = new Vector3(0, 1000f, 0); cube.GameObject.layer = LayerMask.NameToLayer("Map"); } last = current; } } }
private void DrawRoads(TownGeometry geometry, StringBuilder sb) { Roads = new GameObject("Roads"); Roads.transform.parent = child; Roads.transform.localPosition = Vector3.zero; Cube cube; foreach (var road in geometry.Roads) { Geom.Vector2 last = new Geom.Vector2(0, 0); foreach (var current in road) { if (last.x != 0 && last.y != 0) { cube = new Cube("Road", GetLineVertices( last.x, current.x, last.y, current.y, 2 ), 0.2f, rendererOptions.RoadMaterial, Roads.transform); cube.Transform.localPosition = Vector3.zero; } last = current; } } }
private void DrawRoads(TownGeometry geometry, StringBuilder sb) { Roads = new GameObject("Roads"); Roads.transform.parent = child; foreach (var road in geometry.Roads) { Geom.Vector2 last = new Geom.Vector2(0, 0); foreach (var current in road) { if (last.x != 0 && last.y != 0) { new Cube("Road", GetLineVertices( last.x, current.x, last.y, current.y, 2 ), 0.2f, RoadMaterial, Roads.transform); } last = current; } } }