public void BuildObject(string pathXml, bool useUnityVector = false) { gUtility.CXml xSpline = new gUtility.CXml(pathXml, false); if (useUnityVector) { for (int i = 1; i <= xSpline.Settings["Points"].GetNamedChildrenCount("P"); ++i) { string POINT = string.Format("Points/P#{0}", i); gUtility.Vector3 pos = xSpline.Settings[POINT].ReadVector3("value", gUtility.Vector3.ZERO); Vector3 posU = new Vector3(pos.x, pos.y + 0.05f, pos.z); points.Add(posU); } } else { for (int i = 1; i <= xSpline.Settings.GetNamedChildrenCount("P"); ++i) { string POINT = string.Format("P#{0}", i); gUtility.Vector3 pos = xSpline.Settings[POINT].ReadVector3("pos", gUtility.Vector3.ZERO); Vector3 posU = new Vector3(-pos.x, pos.z, -pos.y); points.Add(posU); /* * GameObject point = GameObject.CreatePrimitive(PrimitiveType.Capsule); //new GameObject(string.Format("point{0}", i - 1)); * point.name = string.Format("point{0}", i - 1); * point.transform.localScale = new UnityEngine.Vector3(0.5f, 2.0f, 0.5f); * point.transform.SetParent(pointsObj.transform); * point.transform.position = posU; */ } } }
public void ExportXml(string pathXml) { gUtility.CXml xSpline = new gUtility.CXml(pathXml, true); for (int i = 0; i < points.Count; i++) { string POINT = string.Format("Points/P#{0}", i + 1); gUtility.Vector3 pos = new gUtility.Vector3(-points[i].x, points[i].z, -points[i].y); xSpline.Settings[POINT].WriteVector3("value", pos); } xSpline.Commit(); }
public void BuildObject(string pathXml) { gUtility.CXml xSpline = new gUtility.CXml(pathXml, false); pacenotes = new GameObject("LayoutPacenotes"); pacenotes.transform.SetParent(transform); for (int i = 1; i <= xSpline.Settings.GetNamedChildrenCount("P"); ++i) { string POINT = string.Format("P#{0}", i); gUtility.Vector3 pos = xSpline.Settings[POINT].ReadVector3("pos", gUtility.Vector3.ZERO); Vector3 posU = new Vector3(-pos.x, pos.z, -pos.y); points.Add(posU); /* * GameObject point = GameObject.CreatePrimitive(PrimitiveType.Capsule); //new GameObject(string.Format("point{0}", i - 1)); * point.name = string.Format("point{0}", i - 1); * point.transform.localScale = new UnityEngine.Vector3(0.5f, 2.0f, 0.5f); * point.transform.SetParent(pointsObj.transform); * point.transform.position = posU; */ } calcLength(); }