예제 #1
0
    private Dictionary <string, int> GetBreakdownAndAwardPoints(GameSessionStats stats)
    {
        Dictionary <string, int> result = new Dictionary <string, int>();
        int awardSum = 0;

        // Linear award for bugs eaten.
        if (stats.bugsEaten > 0)
        {
            result.Add("BUGS EATEN", stats.bugsEaten);
            awardSum += stats.bugsEaten;
        }

        // Bonus points for rare bugs.
        if (stats.firefliesEaten > 0)
        {
            result.Add("FIREFLIES EATEN", stats.firefliesEaten);
            awardSum += stats.firefliesEaten;
        }

        // Difficulty/survival multiplier.
        if (stats.highestDifficulty >= 3)
        {
            // Bonus (scales with bugs eaten) starts with 5% at difficulty level 3, and increases by 2% every 2 levels.
            float multiplier = 0.05f + ((stats.highestDifficulty - 3) / 2) * 0.02f;

            int bugBonus      = Mathf.CeilToInt(stats.bugsEaten * multiplier);
            int standardBonus = (stats.highestDifficulty - 2);
            int bonus         = Mathf.Max(bugBonus, standardBonus);

            result.Add("SURVIVAL BONUS", bonus);
            awardSum += bonus;
        }

        // Leap streak bonuses.
        if (stats.highestLeapStreak >= 30)
        {
            result.Add("FROGTASTIC STREAK", 45);
            awardSum += 45;
        }
        else if (stats.highestLeapStreak >= 20)
        {
            result.Add("INSANE STREAK", 30);
            awardSum += 30;
        }
        else if (stats.highestLeapStreak >= 15)
        {
            result.Add("AMAZING STREAK", 20);
            awardSum += 20;
        }
        else if (stats.highestLeapStreak >= 10)
        {
            result.Add("GREAT STREAK", 10);
            awardSum += 10;
        }

        // Sum up breakdown.
        shop.AwardFrogPoints(awardSum);
        return(result);
    }
예제 #2
0
    private void HandleVideoAdRewarded(object sender, Reward args)
    {
        isWatchingRewardVid = false;
        isShowingAd         = false;

        DialogBoxUI.instance.Display("REWARD", "You earned [FFF723]20 Frog Points[-]!", null);
        shop.AwardFrogPoints(20);

        int totalAdsWatched = PlayerPrefs.GetInt("AdsWatched", 0);
        int adsWatchedToday = PlayerPrefs.GetInt("AdsWatchedToday", 0);

        totalAdsWatched++;
        adsWatchedToday++;

        PlayerPrefs.SetInt("AdsWatched", totalAdsWatched);
        PlayerPrefs.SetInt("AdsWatchedToday", adsWatchedToday);

        achieve.UpdateProgressAll(true);
    }