Exemplo n.º 1
0
 private void Update()
 {
     if (m_xpQueue.Count == 0)
     {
         SetEnabledAll(false);
     }
     else
     {
         XpData xpData = m_xpQueue.Peek();
         if (xpData.m_startShowingTime == 0f)
         {
             m_currentShowedLevelUpMessage = false;
             m_currentShowTime             = m_showTime;
             if (xpData.m_levelUp != 0)
             {
                 m_currentShowTime *= 2f;
             }
             xpData.m_startShowingTime = Time.time;
             m_xpBarMain.fillAmount    = xpData.m_percentXPFilled;
             m_xpGainLabel.text        = "+" + xpData.m_xpWon;
             m_xpGainLabel.color       = Color.white;
         }
         Single num = Time.time - xpData.m_startShowingTime;
         if (num <= m_fadeTime)
         {
             Single alpha = num / m_fadeTime;
             m_xpBarBackground.alpha = alpha;
             m_xpBarMain.alpha       = alpha;
             m_xpGainLabel.alpha     = alpha;
         }
         else if (num <= m_fadeTime + m_currentShowTime)
         {
             m_xpBarBackground.alpha = 1f;
             m_xpBarMain.alpha       = 1f;
             m_xpGainLabel.alpha     = 1f;
             if (!m_currentShowedLevelUpMessage && xpData.m_levelUp != 0 && num > m_fadeTime + m_showTime)
             {
                 m_currentShowedLevelUpMessage = true;
                 m_xpGainLabel.color           = Color.green;
                 m_xpGainLabel.text            = LocaManager.GetText("CHARACTER_LEVEL", xpData.m_levelUp);
             }
         }
         else if (num <= m_fadeTime + m_currentShowTime + m_fadeTime)
         {
             Single alpha2 = 1f - (num - (m_fadeTime + m_showTime)) / m_fadeTime;
             m_xpBarBackground.alpha = alpha2;
             m_xpBarMain.alpha       = alpha2;
             m_xpGainLabel.alpha     = alpha2;
         }
         else
         {
             m_xpBarBackground.alpha = 0f;
             m_xpBarMain.alpha       = 0f;
             m_xpGainLabel.alpha     = 0f;
             m_xpQueue.Dequeue();
         }
     }
 }
Exemplo n.º 2
0
        public void AddXpWon(Int32 xpWon, Int32 levelup, Single percentXPFilled)
        {
            if (!enabled)
            {
                SetEnabledAll(true);
            }
            XpData item = new XpData(xpWon, levelup, percentXPFilled);

            m_xpQueue.Enqueue(item);
        }