コード例 #1
0
ファイル: AbilitySystem.cs プロジェクト: HOBOOK/Flat-Heroes
    public static void SetObtainAbility(int id)
    {
        Ability userAb = userAbilities.Find(x => x.id == id || x.id.Equals(id));

        if (userAb != null)
        {
            userAb.level      += 1;
            User.abilityCount += 1;
            SaveSystem.SavePlayer();
            AbilityDatabase.SaveAbility(id);
        }
        else
        {
            Ability ab = abilities.Find(ability => ability.id == id || ability.id.Equals(id));
            if (ab != null)
            {
                User.abilityCount += 1;
                SaveSystem.SavePlayer();
                ab.level = 1;
                userAbilities.Add(ab);
                AbilityDatabase.AddAbility(id);
            }
        }
    }