예제 #1
0
        private MapMatrix[] matrix;              // an array containing all boards in the game

        public MetaMapMatrix(GameSession parent)
        {
            parentSession = parent;
            fixedlist     = new List <List <string> >();
            // read file
            var list = new List <string>();
            var rx   = new Regex("\t");                                        //regex do tabulatur

            foreach (string el in File.ReadAllLines("../../Maps/MetaMap.txt")) // w folderze glownym gry nalezy stworzyc folder Maps i tam wrzucać pliki
            {
                list.Add(el);                                                  // otwieramy plik i spisujemy linijki
            }

            foreach (string el in list)
            {
                string[] tmp     = rx.Split(el);
                var      tmpList = new List <string>();
                foreach (string elm in tmp)
                {
                    tmpList.Add(elm);
                    if (tmpList.Contains("randominteractions=true"))
                    {
                        randomInteractionMaps++;
                    }                                                                             // zliczaj mapy pozwalające na losowe interakcje
                }
                fixedlist.Add(tmpList);
            }
            // read const
            string[] pair;
            maps = list.Count - 1;
            foreach (string el in fixedlist[0])
            {
                pair = el.Split('=');
                switch (pair[0])
                {
                case "portals":
                    portals = Convert.ToInt32(pair[1]);
                    break;

                case "shops":
                    shops = Convert.ToInt32(pair[1]);
                    break;

                case "interactions":
                    interactions = Convert.ToInt32(pair[1]);
                    break;

                case "monsters":
                    monsters = Convert.ToInt32(pair[1]);
                    break;

                case "walls":
                    walls = Convert.ToInt32(pair[1]);
                    break;
                }
            }
            // create adjacency matrix
            CreateAdjencymatrix();
            // generate interactions
            GenerateInteractions();
            GenerateQuests();
            CheckPregeneratedQuests();
            totalIntNumber = interactionList.Count;
            // create maps
            matrix = new MapMatrix[maps];
            for (int i = 0; i < maps; i++)
            {
                if (fixedlist[i + 1][0].Contains("file="))
                {
                    File.WriteAllText("../../Maps/Debug.txt", "map from \"file=\" was created");
                    matrix[i] = new MapMatrix(parentSession, "../../Maps/" + fixedlist[i + 1][0].Split('=')[1]);
                }
                else
                {
                    matrix[i] = new MapMatrix(parentSession, MakePortalsList(i), CreateQuests(i), rng.Next(1000 * maps), (monsters, walls));
                    //matrix[i] = new MapMatrix(parentSession, MakePortalsList(i), CreateQuests(i), rng.Next(1000 * maps), CreateMonsters(i), walls);
                }
            }
        }
예제 #2
0
 } = false;                                              // has the player won?
 public Battle(GameSession ses, BattleScene scene, Monster monster) : base("battle0001", ses)
 {
     Monster              = monster;
     battleScene          = scene;
     battleScene.ImgSetup = GetImage();
 }
예제 #3
0
 // produce an interaction or a group of interactions
 public static List <Interaction> DrawInteractions(GameSession parentSession)
 {
     return(interactionFactories[RNG(0, interactionFactories.Count)].CreateInteractionsGroup(parentSession));
 }