public static EssenceDatabase Load(string path) { TextAsset _xml = Resources.Load <TextAsset>(path); XmlSerializer serializer = new XmlSerializer(typeof(EssenceDatabase)); StringReader reader = new StringReader(_xml.text); EssenceDatabase essences = serializer.Deserialize(reader) as EssenceDatabase; reader.Close(); return(essences); }
// Use this for initialization void Start() { dataArmor = ArmorDatabase.Load("Armors"); dataEnemy = EnemyDatabase.Load("Enemies"); dataEss = EssenceDatabase.Load("Essences"); dataItem = ItemDatabase.Load("Items"); dataNpc = NPCDatabase.Load("NPCs"); dataPot = PotionDatabase.Load("Potions"); dataScroll = ScrollDatabase.Load("Scrolls"); dataSkill = SkillDatabase.Load("Skills"); dataTali = TalismanDatabase.Load("Talismans"); dataWep = WeaponDatabase.Load("Weapons"); Debug.Log("Database Loaded"); foreach (Armor arm in dataArmor.armors) { arm.found = true; if (arm.found) { Debug.Log("Armor 0" + arm.ID + ":" + arm.Name); } } }