Example #1
0
    void GetExp(CatItem catItem)
    {
        Debug.Log(catItem.type.name + " Cat get " + catItem.expGame + " exp");

        while (catItem.expGame > 0)
        {
            catItem.exp++;
            catItem.expGame--;

            if (catItem.exp >= Game.balance.catLevelsExp[catItem.level - 1])
            {
                catItem.LevelUp();
            }
        }
    }
Example #2
0
    public CatItem GetCat(CatType type, int level = 1)
    {
        if (type == null)
        {
            return(null);
        }

        CatItem catItem = null;

        if (isOwned(type))
        {
            isLastGetCatLevelUp = true;

            catItem = GetItem(type);

            catItem.LevelUp(resetExp: false);
        }
        else
        {
            isLastGetCatLevelUp = false;

            catItem = new CatItem(type, level, 0);
            collection.Add(catItem);
            Log("Player get " + type.name + " Cat");

            Analytic.EventProperties("Progress", "OpenCatBox", catItem.type.name);
            Analytic.EventProperties("Progress", "Collection", collection.Count.ToString());
            achievements.OnGetSuperCat();
        }

        lastGetCat = catItem;

        CollectionSave(true);

        return(catItem);
    }