Пример #1
0
 public static void InsertNewNodeDungeons(TreeDungeon tree)
 {
     for (int i = 0; i < 2; i++)
     {
         tree.TraverseNodes(0, 2);
     }
 }
Пример #2
0
        public static Level CreateLevel(int height, int width)
        {
            string[,] textRepr = new string[height, width];
            //This has a size of 0 * 100 and placement in the middle to have a starting point for children.
            DungeonData parentData = new DungeonData {
                TopX = 0, TopY = 100, Width = 0, Height = 0
            };
            DungeonData leftData = new DungeonData {
                TopX = 0, TopY = 0, Width = 250, Height = 100
            };
            DungeonData rightData = new DungeonData {
                TopX = 0, TopY = 100, Width = 250, Height = 100
            };
            NodeDungeon parentNode = new NodeDungeon(parentData);
            TreeDungeon tree       = new TreeDungeon(parentNode);

            tree.InsertNewNode(leftData.TopY, leftData);
            tree.InsertNewNode(rightData.TopY, rightData);
            InsertNewNodeDungeons(tree);

            List <NodeDungeon> dNodes = new List <NodeDungeon>();

            dNodes   = tree.GetDungeonNodes(tree.rootNode, dNodes);
            dNodes   = CreateDungeonRooms(dNodes);
            textRepr = ConvertDungeonToText(dNodes, height, width);

            Level newLevel = new Level(textRepr);

            return(newLevel);
        }