Ejemplo n.º 1
0
    public void LevelUp()
    {
        if (level >= Missions.MAX_LEVEL)
        {
            return;
        }

        Level l = Missions.LEVELS[level];

        foreach (Mission mission in l.missions)
        {
            Analytic.EventProperties("Missions", mission.name + " " + mission.target, Analytic.Round(mission.current()).ToString());
        }

        foreach (Mission mission in l.missions)
        {
            if (mission.clear != null)
            {
                mission.clear();
            }
        }

        if (l.gift == Gifts.catbox && !isCanGetSimpleBox)
        {
            Missions.AddGift(level, Gifts.aquariumSmall, 10);
        }

        if (l.gift == Gifts.aquariumSmall)
        {
            UpdateCoins(l.giftCount, true);
        }
        else if (l.gift == Gifts.sausage)
        {
            UpdateSpins(l.giftCount, true);
        }
        else if (l.gift == Gifts.catbox)
        {
            GetSimpleCatbox();
        }
        else if (l.gift == Gifts.boosterbox)
        {
            GetBonusBox();
        }

        if (l.giftSprite == gameplay.boosts.time.sprite)
        {
            GetBoost(gameplay.boosts.time, 3);
        }
        else if (l.giftSprite == gameplay.boosts.experience.sprite)
        {
            GetBoost(gameplay.boosts.experience, 3);
        }
        else if (l.giftSprite == gameplay.boosts.multiplier.sprite)
        {
            GetBoost(gameplay.boosts.multiplier, 3);
        }
        else if (l.giftSprite == gameplay.boosts.firework.sprite)
        {
            GetBoost(gameplay.boosts.firework, 3);
        }

        UpdateLevel(level + 1, true);

        ui.header.UpdateLevel();

        achievements.OnLevelUp();

        Analytic.EventLevelUp(level);
    }