예제 #1
0
        public static void Load()
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(MonstersData));
            XmlTextReader textReader   = new XmlTextReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("DungeonExplorer.data.monsters.xml"));

            textReader.Normalization = false;
            MonstersData             = (MonstersData)deserializer.Deserialize(textReader);
            textReader.Close();
        }
예제 #2
0
        private void loadMonsters()
        {
            IEnumerable <XElement> monsters; // <item> tag
            XDocument xDoc = XDocument.Load(monstersParemetersPath);

            monsters = xDoc.Descendants("monsters").Elements();;
            foreach (XElement monster in monsters)
            {
                if (monster.Nodes() != null)
                {
                    string mName = monster.Attribute("name").Value;
                    Dictionary <string, string> monsterParameters = new Dictionary <string, string>();
                    List <string> monsterActions = new List <string>();

                    foreach (XElement valTag in monster.Nodes())
                    {
                        if (valTag.Attribute("name").Value.Equals("actions"))
                        {
                            foreach (XElement action in valTag.Nodes())
                            {
                                monsterActions.Add(action.Value);
                            }
                        }
                        else
                        {
                            monsterParameters.Add(valTag.Attribute("name").Value, valTag.Value);
                        }
                    }

                    MonstersData monsterData = new MonstersData();
                    monsterData.monsterName        = mName;
                    monsterData.monsterParameters  = monsterParameters;
                    monsterData.monsterActionsList = monsterActions;
                    ResourcesManager.monstersData.Add(monsterData);
                }
            }
        }
예제 #3
0
 public A_Monster createMonster(MonstersData mData) => new NativeFireR1(mData.monsterName, mData.monsterParameters["mRank"], Convert.ToInt32(mData.monsterParameters["mPrice"]),
                                                                        mData.monsterParameters, mData.monsterActionsList);
예제 #4
0
 private A_Monster addMonster(MonstersList monster, MonstersData mData) => mFactories[monster].createMonster(mData);