示例#1
0
        //fills section with content
        public void FillSection(int widh, int hight, Ground[,] map, string filepath)
        {
            StreamReader sr = new StreamReader("templates/testfile.txt");

            for (int key = 0; key < templateamount; key++)
            {
                templatedic[key] = new List<string>();
                for (int templ = 0; templ < 6; templ++)
                {
                    line = sr.ReadLine();
                    templatedic[key].Add(line);
                }
            }
            RoomGen(hight, widh, map);
            RoomGen(hight, widh, map);
            SingleRoomGen(0, 0, map, 3);
        }
示例#2
0
        //fills a specifik section with room someyhing diffrent in for loop
        public void FillSpecifikSection(int widh, int hight, Ground[,] map, string filepath)
        {
            StreamReader sr = new StreamReader("templates/testfile1.txt");

            for (int i = 0; i < 2; i++)
            {
                int key = int.Parse(sr.ReadLine());
                fixedtemplatedic[key] = new List<string>();
                for (int templ = 0; templ < templatesize; templ++)
                {
                    line = sr.ReadLine();
                    fixedtemplatedic[key].Add(line);
                }
            }
            SingleRoomGen(0, 0, map, 3);
        }
示例#3
0
        //generates room on specifik location
        private void SingleRoomGen(int widh, int hight, Ground[,] map, int template)
        {
            for (int i = 0; i < 6; i++)
            {
                int k = i + widh;
                List<string> templist = templatedic[template];
                string[] type = templist[i].Split(',');

                for (int u = 0; u < 6; u++)
                {
                    int s = u + hight;
                    TypeSelector(type[u], k, s, map);
                }
            }
        }
示例#4
0
        //selects what type of terrein should be located where
        private void TypeSelector(string type, int i, int u, Ground[,] map)
        {
            int prob;
            switch (type)
            {
                case "0":
                    map[i, u].Isfilled = false;
                    map[i, u].ChangeType(floorid);
                    map[i, u].ShadowCaster = false;
                    break;
                case "1":
                    break;
                case "2":
                    prob = rin.Next(100);
                    if (prob < 70)
                        map[i, u].Isfilled = false;
                    map[i, u].ChangeType(floorid);
                    break;
                case "3":
                    map[i, u].ChangeType(brick_wallid);
                    break;

            }
        }
示例#5
0
        //generates rooms
        private void RoomGen(int widh, int hight, Ground[,] map)
        {
            int typerand = RandomInt.Instance.Next(0, 6);

            for (int i = 0; i < 6; i++)
            {
                int k = i + widh;
                List<string> templist = templatedic[typerand];
                string[] type = templist[i].Split(',');

                for (int u = 0; u < 6; u++)
                {
                    int s = u + hight;
                    TypeSelector(type[u], k, s, map);
                }
            }
        }