Exemplo n.º 1
0
        protected void ShowLevelProgress()
        {
            float xpTotal  = _playerManager.xp + (int)_safePlayerPrefs.GetFloat_EarnedExp() + _expForWinAttempts;
            float xpNeeded = GetXpNeeded(_playerManager.level);
            float Min      = 0;

            if (_playerManager.level > 1)
            {
                Min = GetXpNeeded(_playerManager.level - 1);
            }

            Debug.Log("level " + _playerManager.level);
            float expBarValue = (xpNeeded - Min + (xpTotal - xpNeeded)) / Math.Abs(xpNeeded - Min);

            Debug.Log("expBarValue " + expBarValue + " xpTotal " + xpTotal + " xpNeeded " + xpNeeded + " Min " + Min);
            _imageExpProgrssBar.DOFillAmount(expBarValue, 1f).OnComplete(
                () =>
            {
                Debug.Log("expBarValue 1 " + expBarValue);
                if (expBarValue > 1f)
                {
                    Debug.Log("expBarValue " + expBarValue);
                    ShowlvlProgressUP(_imageExpProgrssBar, xpTotal, xpNeeded, (val, lvl) =>
                    {
                        Debug.Log("Callback_XpBonus(val, lvl); ");
                        Callback_XpBonus(val, lvl);
                    });
                }
                else
                {
                    Callback_XpBonus(_imageExpPemium.fillAmount, _playerManager.level);
                }
            }
                );
        }
Exemplo n.º 2
0
 private void CalculatePlayerXP(int bonusXP)
 {
     //Debug.Log("GetFloat_EarnedExp " + _safePlayerPrefs.GetFloat_EarnedExp() + "  bonusXP  " + bonusXP);
     _safePlayerPrefs.SavePlayerExp(_safePlayerPrefs.GetFloat_EarnedExp() + bonusXP);
 }