Пример #1
0
        private void HandleShowResult(ShowResult result)
        {
            switch (result)
            {
            case ShowResult.Finished:
                Debug.Log("The ad was successfully shown.");
                //
                // YOUR CODE TO REWARD THE GAMER
                // Give coins etc.
                var bonus = Player.CurrentBonus;
                switch (bonus)
                {
                case Player.AdSelector.Damage:
                    var dmgmodifier = 1.2f;
                    Player.SetModifier(Player.AdSelector.Damage, dmgmodifier, BonusTime);
                    Player.CurrentBonus = Player.AdSelector.Currency;
                    UIManager.CreateNotificications("Congratulations!", "You have gained " + (int)(dmgmodifier * 100 - 100) + "% damage bonus for " + BonusTime / 60 + " minutes!");
                    break;

                case Player.AdSelector.Currency:
                    var curmodifier = 1.5f;
                    Player.SetModifier(Player.AdSelector.Currency, curmodifier, BonusTime);
                    Player.CurrentBonus = Player.AdSelector.Damage;
                    UIManager.CreateNotificications("Congratulations!", "You have gained " + (int)(curmodifier * 100 - 100) + "% income bonus for " + BonusTime / 60 + " minutes!");
                    break;
                }
                Timer.Cooldown(BonusTime, Time.time);                 //burda mı olmalı?
                break;

            case ShowResult.Skipped:
                Debug.Log("The ad was skipped before reaching the end.");
                Timer.Cooldown(WaitTime, Time.time);                 //no cooldown if not finished
                break;

            case ShowResult.Failed:
                Debug.LogError("The ad failed to be shown.");
                Timer.Cooldown(WaitTime, Time.time);                 //no cooldown if not finished
                break;
            }
        }