Exemplo n.º 1
0
    public static void LoadAbility()
    {
        abilities.Clear();
        userAbilities.Clear();
        string          path   = Application.persistentDataPath + "/Xml/Ability.Xml";
        AbilityDatabase ad     = null;
        AbilityDatabase userAd = null;

        if (System.IO.File.Exists(path))
        {
            ad     = AbilityDatabase.Load();
            userAd = AbilityDatabase.LoadUser();
        }
        else
        {
            ad     = AbilityDatabase.InitSetting();
            userAd = AbilityDatabase.LoadUser();
        }

        if (ad != null)
        {
            foreach (Ability ability in ad.abilities)
            {
                abilities.Add(ability);
            }
        }
        if (userAd != null)
        {
            foreach (Ability ability in userAd.abilities)
            {
                userAbilities.Add(ability);
            }
            SetAbilityStats();
        }
        if (ad != null && userAd != null)
        {
            Debugging.LogSystem("AbilityDatabase is loaded Succesfully.");
        }
    }