private void Write(WalkmeshTriangle triangle, XmlElement node) { foreach (Vector3 coord in triangle.Coords) { Write(coord, node.CreateChildElement("Coord")); } }
public bool ReadWalkmesh(Location location) { if (_root == null) { return(false); } XmlElement node = _root["Walkmesh"]; if (node == null) { return(false); } if (!node.GetBoolean("IsExists")) { return(true); } string wlkPath = Path.ChangeExtension(_xmlPath, ".wlk.xml"); XmlDocument wlkDoc = new XmlDocument(); wlkDoc.Load(wlkPath); node = wlkDoc.GetDocumentElement(); XmlElement trianglesNode = node.GetChildElement("Triangles"); WalkmeshTriangle[] triangles = new WalkmeshTriangle[trianglesNode.ChildNodes.Count]; for (int i = 0; i < triangles.Length; i++) { triangles[i] = ReadWalkmeshTriangle((XmlElement)trianglesNode.ChildNodes[i]); } XmlElement passabilityNode = node.GetChildElement("Passability"); WalkmeshPassability[] passability = new WalkmeshPassability[passabilityNode.ChildNodes.Count]; for (int i = 0; i < passability.Length; i++) { passability[i] = ReadWalkmeshPassability((XmlElement)passabilityNode.ChildNodes[i]); } Walkmesh result = new Walkmesh(triangles, passability); location.Walkmesh = result; location.SaveRequest &= ~LocationProperty.Walkmesh; location.Importable |= LocationProperty.Walkmesh; return(true); }