Esempio n. 1
0
        public Level(ref StreamReader s, XmlDocument xml)
        {
            paused = false;
            ticker = 80;

            var xlevelnum = xml.GetElementsByTagName("LevelNum");
            int xmlLvl = Convert.ToInt32(xlevelnum.Item(0).Value);

            XmlNodeList roomXMLs = xml.GetElementsByTagName("Room");
            Room room1 = new Room(roomXMLs.Item(0));
            if ((line = s.ReadLine()) != null)
                levelNum = Convert.ToInt32(line);

            rooms = new Room[cellNum, cellNum];
            roomMap = new roomState[cellNum, cellNum];
            int numRooms = Convert.ToInt32(s.ReadLine());
            initialRoom = new Vector2(Convert.ToInt64(s.ReadLine()), Convert.ToInt64(s.ReadLine()));

            for (int i = 0; i < cellNum; i++) {
                for (int j = 0; j < cellNum; j++)
                    rooms[i, j] = null;
            }

            while(numRooms > 0){
                int x = Convert.ToInt32(s.ReadLine());
                int y = Convert.ToInt32(s.ReadLine());
                rooms[x, y] = new Room(ref s, x, y);

                roomMap[x, y] = roomState.notVisited;
                numRooms--;
            }
        }
        public Level(ref StreamReader s)
        {
            if ((line = s.ReadLine()) != null)
                levelNum = Convert.ToInt32(line);

            rooms = new Room[cellNum, cellNum];
            int numRooms = Convert.ToInt32(s.ReadLine());
            initialRoom = new Vector2(Convert.ToInt64(s.ReadLine()), Convert.ToInt64(s.ReadLine()));

            for (int i = 0; i < cellNum; i++) {
                for (int j = 0; j < cellNum; j++)
                    rooms[i, j] = null;
            }

            while(numRooms > 0){
                int x = Convert.ToInt32(s.ReadLine());
                int y = Convert.ToInt32(s.ReadLine());
                rooms[x,y] = new Room(ref s, x, y);
                numRooms--;
            }
        }