예제 #1
0
        // Done!
        public ConcreteMap ToConcreteMap()
        {
            ConcreteMap cm = new ConcreteMap(false);

            for (int i = 0; i < this.Count; ++i)
            {
                var node = this[i].ConcreteNode;
                cm.Add(node);
            }
            return(cm);
        }
예제 #2
0
파일: MapFile.cs 프로젝트: r3db/Vlcr
        // Done!
        public static ConcreteMap XmlRawOpen1(string path)
        {
            ConcreteMap map = new ConcreteMap();
            IList <XmlNodeReference> con = new List <XmlNodeReference>();

            Random         r   = new Random();
            XPathDocument  doc = new XPathDocument(path);
            XPathNavigator nav = doc.CreateNavigator();

            var xmlNodes = nav.Select("Nodes/Node");

            while (xmlNodes.MoveNext())
            {
                var cNode = xmlNodes.Current;

                // Add Node!
                var node = new MapNode(cNode.GetAttribute("Name", string.Empty), NodeType.Geometry)
                {
                    Constraints = ParseConstraints(cNode, true, r)
                };
                map.Add(node);

                // Add Geometry
                var xmlGeometry = cNode.Select("Vector");
                while (xmlGeometry.MoveNext())
                {
                    node.Geometry.Add(ParseXmlVector(xmlGeometry.Current));
                }

                // Add Exits
                var xmlExits = cNode.Select("Exit");
                while (xmlExits.MoveNext())
                {
                    con.Add(ParseXmlExit(xmlExits.Current, node));
                }
            }

            // Remake Connectors
            RemakeConnectors(map, con);

            return(map);
        }