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(); }
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); } } }
public A_Monster createMonster(MonstersData mData) => new NativeFireR1(mData.monsterName, mData.monsterParameters["mRank"], Convert.ToInt32(mData.monsterParameters["mPrice"]), mData.monsterParameters, mData.monsterActionsList);
private A_Monster addMonster(MonstersList monster, MonstersData mData) => mFactories[monster].createMonster(mData);